Guest User

Untitled

a guest
Feb 2nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 485.22 KB | None | 0 0
  1. // ==UserScript==
  2. // @name MouseHunt AutoBot Enhanced Edition
  3. // @author Ooi Keng Siang, CnN
  4. // @version 1.37.9
  5. // @namespace http://ooiks.com/blog/mousehunt-autobot, https://devcnn.wordpress.com/
  6. // @description Ooiks: An advance user script to automate sounding the hunter horn in MouseHunt application in Facebook with MouseHunt version 3.0 (Longtail) supported and many other features. CnN: An enhanced version to sound horn based on selected algorithm of event or location.
  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 = false;
  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 = 15;
  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 = true;
  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 = 2;
  63. var krStartHour = 9;
  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: ["Chrome Temporal Turbine","Chrome Grand Arcanum Trap","Rocket Propelled Gavel Trap","Timesplit Dissonance Weapon","Meteor Prison Core Trap","Sprinkly Cupcake Surprise Trap","New Horizon Trap","New Year's Fireworks Trap","Holiday Hydro Hailstone Trap","Festive Forgotten Fir Trap","Interdimensional Crossbow Trap","Droid Archmagus Trap","Sandcastle Shard","Crystal Mineral Crusher Trap","Biomolecular Re-atomizer Trap","Chrome Arcane Capturing Rod","Law Laser Trap","Zugzwang's Ultimate Move","2010 Blastoff Trap","2012 Big Boom Trap","500 Pound Spiked Crusher","Ambrosial Portal","Ambush","Ancient Box Trap","Ancient Gauntlet","Ancient Spear Gun","Arcane Blast Trap","Arcane Capturing Rod Of Never Yielding Mystery","Bandit Deflector","Birthday Candle Kaboom","Birthday Party Piñata Bonanza","Blackstone Pass Trap","Bottomless Grave","Brain Extractor","Bubbles: The Party Crasher Trap","Cackle Lantern Trap","Candy Crusher Trap","Chesla's Revenge","Christmas Cracker Trap","Chrome DeathBot","Chrome DrillBot","Chrome MonstroBot","Chrome Nannybot","Chrome Oasis Water Node Trap","Chrome Onyx Mallet","Chrome Phantasmic Oasis Trap","Chrome RhinoBot","Chrome Sphynx Wrath","Chrome Tacky Glue Trap","Clockapult of Time","Clockapult of Winter Past","Clockwork Portal Trap","Crystal Crucible Trap","Crystal Tower","Digby DrillBot","Dimensional Chest Trap","Double Diamond Adventure","Dragon Lance","Dreaded Totem Trap","Endless Labyrinth Trap","Engine Doubler","Enraged RhinoBot","Event Horizon","Explosive Toboggan Ride","Festive Gauntlet Crusher","Fluffy DeathBot","Focused Crystal Laser","The Forgotten Art of Dance","Forgotten Pressure Plate Trap","Giant Speaker","Gingerbread House Surprise","Glacier Gatler","Gorgon Trap","Grand Arcanum Trap","Grungy DeathBot","Harpoon Gun","Heat Bath","High Tension Spring","HitGrab Horsey","HitGrab Rainbow Rockin' Horse","HitGrab Rockin' Horse","Horrific Venus Mouse Trap","Ice Blaster","Ice Maiden","Icy RhinoBot","Infinite Labyrinth Trap","Isle Idol Trap","Isle Idol Trap","Isle Idol Trap","Kraken Chaos","The Law Draw","Maniacal Brain Extractor","Mouse DeathBot","Mouse Hot Tub","Mouse Mary O'Nette","Mouse Rocketine","Mouse Trebuchet","Multi-Crystal Laser","Mutated Venus Mouse Trap","Mysteriously unYielding Null-Onyx Rampart of Cascading Amperes","Mystic Pawn Pincher","Nannybot","Net Cannon","Ninja Ambush Trap","Nutcracker Nuisance Trap","NVMRC Forcefield Trap","Oasis Water Node Trap","Obelisk of Incineration","Obelisk of Slumber","Obvious Ambush Trap","Onyx Mallet","PartyBot","Phantasmic Oasis Trap","Pneumatic Tube Trap","Pumpkin Pummeler","Reaper's Perch","Rewers Riposte","RhinoBot","Rune Shark Trap","S.A.M. F.E.D. DN-5","S.L.A.C.","S.L.A.C. II","S.U.P.E.R. Scum Scrubber","Sandstorm MonstroBot","Sandtail Sentinel","School of Sharks","Scum Scrubber","Shrink Ray Trap","Sinister Portal","Snow Barrage","Snowglobe Trap","Soul Catcher","Soul Harvester","Sphynx Wrath","Stale Cupcake Golem Trap","Steam Laser Mk. I","Steam Laser Mk. II","Steam Laser Mk. II (Broken!)","Steam Laser Mk. III","Supply Grabber","Swiss Army Mouse Trap","Tacky Glue Trap","Tarannosaurus Rex Trap","Technic Pawn Pincher","Temporal Turbine","Terrifying Spider Trap","Thorned Venus Mouse Trap","Ultra MegaMouser MechaBot Trap","Veiled Vine Trap","Venus Mouse Trap","Warden Slayer Trap","Warpath Thrasher","Wrapped Gift Trap","Zugzwang's First Move","Zugzwang's Last Move","Zurreal's Folly"],
  140. base: ["Ancient Booster Base","Ultimate Iceberg Base","Clockwork Base","Sprinkly Sweet Cupcake Birthday Base","Rooster Jade Base","2017 New Year's Base","Aqua Base","Attuned Enerchi Induction Base","Bacon Base","Bamboozler Base","Birthday Cake Base","Birthday Dragée Cake Base","Bronze Tournament Base","Candy Cane Base","Carrot Birthday Cake Base","Cheesecake Base","Chocolate Birthday Cake Base","Claw Shot Base","Crushed Birthday Cake Base","Cupcake Birthday Base","Deep Freeze Base","Dehydration Base","Depth Charge Base","Dragon Jade Base","Eerie Base","Eerier Base","Enerchi Induction Base","Explosive Base","Extra Sweet Cupcake Birthday Base","Fan Base","Firecracker Base","Fissure Base","Fracture Base","Gingerbread Base","Golden Tournament Base","Hearthstone Base","Horse Jade Base","Hothouse Base","Jade Base","Labyrinth Base","Living Base","Magma Base","Magnet Base","Minotaur Base","Molten Shrapnel Base","Monkey Jade Base","Monolith Base","Papyrus Base","Physical Brace Base","Polar Base","Polluted Base","Refined Pollutinum Base","Remote Detonator Base","Rift Base","Runic Base","Seasonal Base","Sheep Jade Base","Silver Tournament Base","Skello-ton Base","Snake Jade Base","Soiled Base","Spellbook Base","Spiked Base","Stone Base","Tidal Base","Tiki Base","Tribal Base","Tribal Kaboom Base","Washboard Base","Wooden Base","Wooden Base with Target"],
  141. bait: ["Magical Rancid Radioactive Blue Cheese","Undead String Emmental","Ancient String Cheese","Runic String Cheese","Sunrise Cheese","Dumpling Cheese","Crescent Cheese","Ancient Cheese","Arctic Asiago Cheese","Ascended Cheese","Brie Cheese","Brie String Cheese","Candy Corn Cheese","Checkmate Cheese","Cheddar Cheese","Cherry Cheese","Combat Cheese","Creamy Havarti Cheese","Crunchy Cheese","Crunchy Havarti Cheese","Cupcake Colby","Dewthief Camembert","Diamond Cheese","Duskshade Camembert","Extra Sweet Cupcake Colby","Festive Feta","Fishy Fromage","Fusion Fondue","Galleon Gouda","Gauntlet Cheese Tier 2","Gauntlet Cheese Tier 3","Gauntlet Cheese Tier 4","Gauntlet Cheese Tier 5","Gauntlet Cheese Tier 6","Gauntlet Cheese Tier 7","Gauntlet Cheese Tier 8","Gemstone Cheese","Ghoulgonzola Cheese","Gilded Cheese","Gingerbread Cheese","Glowing Gruyere Cheese","Glutter Cheese","Gnarled Cheese","Gouda Cheese","Graveblossom Camembert","Grilled Cheese","Gumbo Cheese","Inferno Havarti Cheese","Lactrodectus Lancashire Cheese","Limelight Cheese","Lunaria Camembert","Magical Havarti Cheese","Magical String Cheese","Maki Cheese","Maki String Cheese","Marble Cheese","Marble String Cheese","Marshmallow Monterey","Master Fusion Cheese","Mineral Cheese","Moon Cheese","Mozzarella Cheese","Null Onyx Gorgonzola","Nutmeg Cheese","Onyx Gorgonzola","Polluted Parmesan Cheese","Pungent Havarti Cheese","Radioactive Blue Cheese","Rancid Radioactive Blue Cheese","Rift Combat Cheese","Rift Glutter Cheese","Rift Rumble Cheese","Rift Susheese Cheese","Riftiago Cheese","Resonator Cheese","Rockforth Cheese","Rumble Cheese","Runic Cheese","Runny Cheese","Seasoned Gouda","Shell Cheese","Snowball Bocconcini","Spicy Havarti Cheese","SUPER|brie+","Susheese Cheese","Sweet Havarti Cheese","Swiss Cheese","Swiss String Cheese","Terre Ricotta Cheese","Toxic Brie","Toxic SUPER|brie+","Undead Emmental","Vanilla Stilton Cheese","Vengeful Vanilla Stilton Cheese","White Cheddar Cheese","Wicked Gnarly Cheese"],
  142. trinket: ["Rift Airship Charm","Ultimate Wealth Charm","Super Enerchi Charm","Rift Charm","Nightlight Charm","Rift Wealth Charm","Rift Extreme Luck Charm","Rift Luck Charm","Rift Super Luck Charm","Rift Antiskele Charm","Realm Ripper Charm","Timesplit Charm","Lucky Valentine Charm","Festive Anchor Charm","2014 Charm","2015 Charm","2016 Charm","2017 Charm","Airship Charm","Amplifier Charm","Ancient Charm","Antiskele Charm","Artisan Charm","Athlete Charm","Attraction Charm","Baitkeep Charm","Black Powder Charm","Blue Double Sponge Charm","Brain Charm","Bravery Charm","Cackle Charm","Cactus Charm","Candy Charm","Champion Charm","Cherry Charm","Chrome Charm","Clarity Charm","Compass Magnet Charm","Crucible Cloning Charm","Cupcake Charm","Dark Chocolate Charm","Derr Power Charm","Diamond Boost Charm","Door Guard Charm","Dragonbane Charm","Dragonbreath Charm","Dreaded Charm","Dusty Coal Charm","Eggscavator Charge Charm","Eggstra Charge Charm","Eggstra Charm","Elub Power Charm","EMP400 Charm","Empowered Anchor Charm","Enerchi Charm","Extra Spooky Charm","Extra Sweet Cupcake Charm","Extreme Ancient Charm","Extreme Attraction Charm","Extreme Luck Charm","Extreme Polluted Charm","Extreme Power Charm","Extreme Wealth Charm","Festive Ultimate Luck Charm","Festive Ultimate Power Charm","Firecracker Charm","First Ever Charm","Flamebane Charm","Forgotten Charm","Freshness Charm","Gargantua Guarantee Charm","Gemstone Boost Charm","Gilded Charm","Glowing Gourd Charm","Gnarled Charm","Golden Anchor Charm","Greasy Glob Charm","Growth Charm","Grub Salt Charm","Grub Scent Charm","Grubling Bonanza Charm","Grubling Chow Charm","Haunted Ultimate Luck Charm","Horsepower Charm","Hydro Charm","Lantern Oil Charm","Luck Charm","Lucky Power Charm","Lucky Rabbit Charm","Magmatic Crystal Charm","Mining Charm","Mobile Charm","Monger Charm","Monkey Fling Charm","Nanny Charm","Nerg Power Charm","Nightshade Farming Charm","Nitropop Charm","Oxygen Burst Charm","Party Charm","Polluted Charm","Power Charm","Prospector's Charm","Rainbow Luck Charm","Ramming Speed Charm","Red Double Sponge Charm","Red Sponge Charm","Regal Charm","Rift Power Charm","Rift Ultimate Luck Charm","Rift Ultimate Lucky Power Charm","Rift Ultimate Power Charm","Rift Vacuum Charm","Roof Rack Charm","Rook Crumble Charm","Rotten Charm","Safeguard Charm","Scholar Charm","Scientist's Charm","Searcher Charm","Shadow Charm","Shamrock Charm","Shattering Charm","Sheriff's Badge Charm","Shielding Charm","Shine Charm","Shortcut Charm","Smart Water Jet Charm","Snakebite Charm","Snowball Charm","Soap Charm","Softserve Charm","Spellbook Charm","Spiked Anchor Charm","Sponge Charm","Spooky Charm","Spore Charm","Stagnant Charm","Sticky Charm","Striker Charm","Super Ancient Charm","Super Attraction Charm","Super Brain Charm","Super Cactus Charm","Super Luck Charm","Super Nightshade Farming Charm","Super Polluted Charm","Super Power Charm","Super Regal Charm","Super Rift Vacuum Charm","Super Rotten Charm","Super Salt Charm","Super Soap Charm","Super Spore Charm","Super Warpath Archer Charm","Super Warpath Cavalry Charm","Super Warpath Commander's Charm","Super Warpath Mage Charm","Super Warpath Scout Charm","Super Warpath Warrior Charm","Super Wealth Charm","Supply Schedule Charm","Tarnished Charm","Taunting Charm","Treasure Trawling Charm","Ultimate Anchor Charm","Ultimate Ancient Charm","Ultimate Attraction Charm","Ultimate Charm","Ultimate Luck Charm","Ultimate Lucky Power Charm","Ultimate Polluted Charm","Ultimate Power Charm","Ultimate Spore Charm","Uncharged Scholar Charm","Unstable Charm","Valentine Charm","Warpath Archer Charm","Warpath Cavalry Charm","Warpath Commander's Charm","Warpath Mage Charm","Warpath Scout Charm","Warpath Warrior Charm","Water Jet Charm","Wax Charm","Wealth Charm","Wild Growth Charm","Winter Builder Charm","Winter Charm","Winter Hoarder Charm","Winter Miser Charm","Winter Screw Charm","Winter Spring Charm","Winter Wood Charm","Yellow Double Sponge Charm","Yellow Sponge Charm"]
  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 Trap','Event Horizon','Grand Arcanum Trap','Chrome Arcane Capturing Rod','Arcane Blast Trap','Arcane Capturing Rod Of Nev'],
  149. draconic : ['Dragon Lance','Ice Maiden'],
  150. forgotten : ['Infinite Labyrinth Trap','Endless Labyrinth Trap','Crystal Crucible Trap','Stale Cupcake Golem Trap','Tarannosaurus Rex Trap','Crystal Mineral Crusher Trap','The Forgotten Art of Dance'],
  151. hydro : ['School of Sharks','Rune Shark Trap','Chrome Phantasmic Oasis Trap','Phantasmic Oasis Trap','Oasis Water Node Trap','Steam Laser Mk. III','Steam Laser Mk. II','Steam Laser Mk. I','Ancient Spear Gun'],
  152. law : ['Meteor Prison Core Trap','The Law Draw','Law Laser Trap','Engine Doubler','Bandit Deflector','Supply Grabber','S.L.A.C. II','S.L.A.C.'],
  153. physical : ['Chrome MonstroBot','Sandstorm MonstroBot','Sandtail Sentinel','Enraged RhinoBot'],
  154. rift : ['Mysteriously unYielding','Multi-Crystal Laser','Focused Crystal Laser','Biomolecular Re-atomizer Trap','Crystal Tower'],
  155. shadow : ['Temporal Turbine','Clockwork Portal Trap','Reaper\'s Perch','Dreaded Totem Trap','Candy Crusher Trap','Clockapult of Time','Clockapult of Winter Past'],
  156. tactical : ['Chrome Sphynx Wrath','Sphynx Wrath','Zugzwang\'s Ultimate Move','Zugzwang\'s First Move']
  157. },
  158. base : {
  159. luck : ['Minotaur 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. }
  162. };
  163.  
  164. // // Fiery Warpath Preference
  165. var commanderCharm = ['Super Warpath Commander\'s', 'Warpath Commander\'s'];
  166. var objPopulation = {
  167. WARRIOR : 0,
  168. SCOUT : 1,
  169. ARCHER : 2,
  170. CAVALRY : 3,
  171. MAGE : 4,
  172. ARTILLERY : 5,
  173. name : ['Warrior', 'Scout', 'Archer', 'Cavalry', 'Mage', 'Artillery']
  174. };
  175. var g_arrFWSupportRetreat = [0, 10, 18, 26];
  176. var g_fwStreakLength = 15;
  177. var objDefaultFW = {
  178. weapon : 'Sandtail Sentinel',
  179. base : 'Physical Brace',
  180. focusType : 'NORMAL',
  181. priorities : 'HIGHEST',
  182. cheese : new Array(g_fwStreakLength).fill('Gouda'),
  183. charmType : new Array(g_fwStreakLength).fill('Warpath'),
  184. special : new Array(g_fwStreakLength).fill('None'),
  185. lastSoldierConfig : 'CONFIG_GOUDA',
  186. includeArtillery : true,
  187. disarmAfterSupportRetreat : false,
  188. warden : {
  189. before : {
  190. weapon : '',
  191. base : '',
  192. trinket : '',
  193. bait : ''
  194. },
  195. after : {
  196. weapon : '',
  197. base : '',
  198. trinket : '',
  199. bait : ''
  200. }
  201. }
  202. };
  203.  
  204. // // Living Garden Preference
  205. var bestLGBase = ['Living Base', 'Hothouse Base'];
  206. var bestSalt = ['Super Salt', 'Grub Salt'];
  207. var redSpongeCharm = ['Red Double', 'Red Sponge'];
  208. var yellowSpongeCharm = ['Yellow Double', 'Yellow Sponge'];
  209. var spongeCharm = ['Double Sponge', 'Sponge'];
  210.  
  211. // // Sunken City Preference
  212. // // DON'T edit this variable if you don't know what are you editing
  213. var objSCZone = {
  214. ZONE_NOT_DIVE : 0,
  215. ZONE_DEFAULT : 1,
  216. ZONE_CORAL : 2,
  217. ZONE_SCALE : 3,
  218. ZONE_BARNACLE : 4,
  219. ZONE_TREASURE : 5,
  220. ZONE_DANGER : 6,
  221. ZONE_DANGER_PP : 7,
  222. ZONE_OXYGEN : 8,
  223. ZONE_BONUS : 9,
  224. ZONE_DANGER_PP_LOTA : 10
  225. };
  226. var bestSCBase = ['Minotaur Base','Fissure Base','Depth Charge Base'];
  227.  
  228. // // Spring Egg Hunt
  229. var chargeCharm = ['Eggstra Charge', 'Eggscavator'];
  230. var chargeHigh = 17;
  231. var chargeMedium = 12;
  232.  
  233. // // Labyrinth
  234. var bestLabyBase = ['Minotaur Base', 'Labyrinth Base'];
  235. var objCodename = {
  236. FEALTY : "y",
  237. TECH : "h",
  238. SCHOLAR : "s",
  239. TREASURY : "t",
  240. FARMING : "f",
  241. PLAIN : "p",
  242. SUPERIOR : "s",
  243. EPIC : "e",
  244. SHORT : "s",
  245. MEDIUM : "m",
  246. LONG : "l"
  247. };
  248. var arrHallwayOrder = [
  249. 'sp','mp','lp',
  250. 'ss','ms','ls',
  251. 'se','me','le'];
  252. var objDefaultLaby = {
  253. districtFocus : 'None',
  254. between0and14 : ['lp'],
  255. between15and59 : ['sp','ls'],
  256. between60and100 : ['sp','ss','le'],
  257. chooseOtherDoors : false,
  258. typeOtherDoors : "SHORTEST_FEWEST",
  259. securityDisarm : false,
  260. lastHunt : 0,
  261. armOtherBase : 'false',
  262. disarmCompass : true,
  263. nDeadEndClue : 0,
  264. weaponFarming : 'Forgotten'
  265. };
  266. var objLength = {
  267. SHORT : 0,
  268. MEDIUM : 1,
  269. LONG : 2
  270. };
  271.  
  272. // // Furoma Rift
  273. var objFRBattery = {
  274. level : [1,2,3,4,5,6,7,8,9,10],
  275. name : ["one","two","three","four","five","six","seven","eight","nine","ten"],
  276. capacity : [20,45,75,120,200,310,450,615,790,975],
  277. cumulative : [20,65,140,260,460,770,1220,1835,2625,3600]
  278. };
  279.  
  280. var g_arrHeirloom = []; // to be refresh once page reload
  281.  
  282. var g_objConstTrap = {
  283. bait : {
  284. ANY_HALLOWEEN : {
  285. sort : 'any',
  286. name : ['Ghoulgonzola', 'Candy Corn']
  287. },
  288. ANY_MASTER : {
  289. sort : 'any',
  290. name : ['Rift Glutter', 'Rift Combat', 'Rift Susheese']
  291. },
  292. ANY_LUNAR : {
  293. sort : 'any',
  294. name : ['Moon Cheese', 'Crescent Cheese']
  295. },
  296. ANY_FESTIVE_BRIE : {
  297. sort : 'best',
  298. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Brie Cheese']
  299. },
  300. ANY_FESTIVE_GOUDA : {
  301. sort : 'best',
  302. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Gouda']
  303. },
  304. ANY_FESTIVE_SB : {
  305. sort : 'best',
  306. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'SUPER']
  307. }
  308. },
  309. trinket : {
  310. GAC_EAC : {
  311. sort : 'best',
  312. name : ['Golden Anchor', 'Empowered Anchor']
  313. },
  314. SAC_EAC : {
  315. sort : 'best',
  316. name : ['Spiked Anchor', 'Empowered Anchor']
  317. },
  318. UAC_EAC : {
  319. sort : 'best',
  320. name : ['Ultimate Anchor', 'Empowered Anchor']
  321. },
  322. 'ANCHOR_FAC/EAC' : {
  323. sort : 'best',
  324. name : ['Festive Anchor Charm', 'Empowered Anchor Charm']
  325. }
  326. }
  327. };
  328.  
  329. // == Advance User Preference Setting (End) ==
  330.  
  331.  
  332.  
  333. // WARNING - Do not modify the code below unless you know how to read and write the script.
  334.  
  335. // All global variable declaration and default value
  336. var g_strVersion = "";
  337. var g_strScriptHandler = "";
  338. var fbPlatform = false;
  339. var hiFivePlatform = false;
  340. var mhPlatform = false;
  341. var mhMobilePlatform = false;
  342. var g_strHTTP = 'http';
  343. var lastDateRecorded = new Date();
  344. var hornTime = 900;
  345. var hornTimeDelay = 0;
  346. var checkTimeDelay = 0;
  347. var isKingReward = false;
  348. var lastKingRewardSumTime;
  349. var g_nBaitQuantity = -1;
  350. var huntLocation;
  351. var currentLocation;
  352. var today = new Date();
  353. var checkTime;
  354. var hornRetryMax = 10;
  355. var hornRetry = 0;
  356. var nextActiveTime = 900;
  357. var timerInterval = 2;
  358. var checkMouseResult = null;
  359. var mouseList = [];
  360. var discharge = false;
  361. var arming = false;
  362. var g_arrArmingList = [];
  363. var kingsRewardRetry = 0;
  364. var keyKR = [];
  365. var separator = "~";
  366.  
  367. // element in page
  368. var titleElement;
  369. var nextHornTimeElement;
  370. var checkTimeElement;
  371. var kingTimeElement;
  372. var lastKingRewardSumTimeElement;
  373. var optionElement;
  374. var travelElement;
  375. var strHornButton = 'hornbutton';
  376. var strCampButton = 'campbutton';
  377. var isNewUI = false;
  378. var debugKR = false;
  379.  
  380. // console logging
  381. function saveToSessionStorage(){
  382. var i;
  383. var str = "";
  384. for(i=0;i<arguments.length;i++){
  385. if(!isNullOrUndefined(arguments[i]) && typeof arguments[i] === 'object'){ // if it is object
  386. str += JSON.stringify(arguments[i]);
  387. }
  388. else
  389. str += arguments[i];
  390. if(i != arguments.length-1)
  391. str += " ";
  392. }
  393. var key = "";
  394. var arrLog = [];
  395. for(i=0;i<window.sessionStorage.length;i++){
  396. key = window.sessionStorage.key(i);
  397. if(key.indexOf("Log_") > -1)
  398. arrLog.push(key);
  399. }
  400. if (arrLog.length > maxSaveLog){
  401. arrLog = arrLog.sort();
  402. var count = Math.floor(maxSaveLog / 2);
  403. for(i=0;i<count;i++)
  404. removeSessionStorage(arrLog[i]);
  405. }
  406. try{
  407. setSessionStorage("Log_" + (performance.timing.navigationStart + performance.now()), str);
  408. }
  409. catch (e){
  410. if(e.name == "QuotaExceededError"){
  411. for(i=0;i<window.sessionStorage.length;i++){
  412. key = window.sessionStorage.key(i);
  413. if(key.indexOf('Log_') > -1)
  414. removeSessionStorage(key);
  415. }
  416. saveToSessionStorage.apply(this,arguments);
  417. }
  418. }
  419. }
  420. console.plog = function(){
  421. saveToSessionStorage.apply(this,arguments);
  422. console.log.apply(console,arguments);
  423. };
  424. console.perror = function(){
  425. saveToSessionStorage.apply(this,arguments);
  426. console.error.apply(console,arguments);
  427. };
  428. console.pdebug = function(){
  429. saveToSessionStorage.apply(this,arguments);
  430. console.debug.apply(console,arguments);
  431. };
  432.  
  433. function FinalizePuzzleImageAnswer(answer){
  434. var myFrame;
  435. if (answer.length != 5) {
  436. //Get a new puzzle
  437. if (kingsRewardRetry >= kingsRewardRetryMax) {
  438. kingsRewardRetry = 0;
  439. setStorage("KingsRewardRetry", kingsRewardRetry);
  440. var strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  441. alert(strTemp);
  442. displayTimer(strTemp, strTemp, strTemp);
  443. console.perror(strTemp);
  444. return;
  445. }
  446. else {
  447. ++kingsRewardRetry;
  448. setStorage("KingsRewardRetry", kingsRewardRetry);
  449. var tagName = document.getElementsByTagName("a");
  450. for (var i = 0; i < tagName.length; i++){
  451. if (tagName[i].innerText == "Click here to get a new one!"){
  452. fireEvent(tagName[i], 'click');
  453. if(isNewUI){
  454. myFrame = document.getElementById('myFrame');
  455. if(!isNullOrUndefined(myFrame))
  456. document.body.removeChild(myFrame);
  457. window.setTimeout(function () { CallKRSolver(); }, 6000);
  458. }
  459. return;
  460. }
  461. }
  462. }
  463. }
  464. else {
  465. //Submit answer
  466. var puzzleAns = document.getElementById("puzzle_answer");
  467. if (isNewUI) puzzleAns = document.getElementsByClassName("mousehuntPage-puzzle-form-code")[0];
  468. if (!puzzleAns){
  469. console.plog("puzzleAns:", puzzleAns);
  470. return;
  471. }
  472. puzzleAns.value = "";
  473. puzzleAns.value = answer.toLowerCase();
  474. var puzzleSubmit = document.getElementById("puzzle_submit");
  475. if (isNewUI) puzzleSubmit = document.getElementsByClassName("mousehuntPage-puzzle-form-code-button")[0];
  476. if (!puzzleSubmit){
  477. console.plog("puzzleSubmit:", puzzleSubmit);
  478. return;
  479. }
  480.  
  481. fireEvent(puzzleSubmit, 'click');
  482. kingsRewardRetry = 0;
  483. setStorage("KingsRewardRetry", kingsRewardRetry);
  484. myFrame = document.getElementById('myFrame');
  485. if (myFrame)
  486. document.body.removeChild(myFrame);
  487. window.setTimeout(function () { CheckKRAnswerCorrectness(); }, 5000);
  488. }
  489. }
  490.  
  491. function receiveMessage(event)
  492. {
  493. if(!debugKR && !isAutoSolve)
  494. return;
  495.  
  496. console.plog("Event origin:", event.origin);
  497. if (event.origin.indexOf("mhcdn") > -1 || event.origin.indexOf("mousehuntgame") > -1 || event.origin.indexOf("dropbox") > -1){
  498. if (event.data.indexOf("~") > -1){
  499. var result = event.data.substring(0, event.data.indexOf("~"));
  500. if (saveKRImage){
  501. var processedImg = event.data.substring(event.data.indexOf("~") + 1, event.data.length);
  502. var strKR = "KR" + separator;
  503. strKR += Date.now() + separator;
  504. strKR += result + separator;
  505. strKR += "RETRY" + kingsRewardRetry;
  506. try{
  507. setStorage(strKR, processedImg);
  508. }
  509. catch (e){
  510. console.perror('receiveMessage',e.message);
  511. }
  512. }
  513. FinalizePuzzleImageAnswer(result);
  514. }
  515. else if(event.data.indexOf("#")>-1){
  516. var value = event.data.substring(1, event.data.length);
  517. setStorage("krCallBack",value);
  518. }
  519. else if(event.data.indexOf('Log_')>-1)
  520. console.plog(event.data.split('_')[1]);
  521. else if(event.data.indexOf('MHAKRS_')>-1){
  522. var temp = event.data.split('_');
  523. console.plog(temp[0], temp[1]);
  524. setStorage(temp[0], temp[1]);
  525. }
  526. }
  527. }
  528.  
  529. window.addEventListener("message", receiveMessage, false);
  530. if (debugKR)
  531. CallKRSolver();
  532.  
  533. var getMapPort;
  534. try{
  535. if(!isNullOrUndefined(chrome.runtime.id)){
  536. g_strScriptHandler = "Extensions";
  537. g_strVersion = chrome.runtime.getManifest().version;
  538. getMapPort = chrome.runtime.connect({name: 'map'});
  539. getMapPort.onMessage.addListener(function(msg) {
  540. console.log(msg);
  541. if(msg.array.length > 0)
  542. checkCaughtMouse(msg.obj, msg.array);
  543. });
  544. }
  545. else{
  546. g_strScriptHandler = GM_info.scriptHandler + " " + GM_info.version;
  547. g_strVersion = GM_info.script.version;
  548. }
  549. }
  550. catch (e){
  551. console.perror('Before exeScript',e.message);
  552. getMapPort = undefined;
  553. g_strVersion = undefined;
  554. g_strScriptHandler = undefined;
  555. }
  556.  
  557. exeScript();
  558.  
  559. function exeScript() {
  560. console.plog("exeScript() Start");
  561. browser = browserDetection();
  562. if (!(browser == 'opera' || browser == 'chrome')){
  563. console.plog(browser + " not supported.");
  564. console.plog("exeScript() End");
  565. return;
  566. }
  567. setStorage('MHAB', g_strVersion);
  568. setStorage('ScriptHandler', g_strScriptHandler);
  569. // check the trap check setting first
  570. trapCheckTimeDiff = GetTrapCheckTime();
  571.  
  572. if (trapCheckTimeDiff == 60)
  573. trapCheckTimeDiff = 0;
  574. else if (trapCheckTimeDiff < 0 || trapCheckTimeDiff > 60) {
  575. // invalid value, just disable the trap check
  576. enableTrapCheck = false;
  577. }
  578.  
  579. if (showTimerInTitle) {
  580. // check if they are running in iFrame
  581. var contentElement = undefined;
  582. var breakFrameDivElement = undefined;
  583. if (window.location.href.indexOf("apps.facebook.com/mousehunt/") != -1) {
  584. contentElement = document.getElementById('pagelet_canvas_content');
  585. if (contentElement) {
  586. breakFrameDivElement = document.createElement('div');
  587. breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
  588. 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";
  589. contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
  590. }
  591. contentElement = undefined;
  592. }
  593. else if (window.location.href.indexOf("hi5.com/friend/games/MouseHunt") != -1) {
  594. contentElement = document.getElementById('apps-canvas-body');
  595. if (contentElement) {
  596. breakFrameDivElement = document.createElement('div');
  597. breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
  598. 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";
  599. contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
  600. }
  601. contentElement = undefined;
  602. }
  603. }
  604.  
  605. // check user running this script from where
  606. if (window.location.href.indexOf("mousehuntgame.com/canvas/") != -1) {
  607. // from facebook
  608. fbPlatform = true;
  609. setStorage('Platform', 'FB');
  610. }
  611. else if (window.location.href.indexOf("mousehuntgame.com") != -1) {
  612. // need to check if it is running in mobile version
  613. var version = getCookie("switch_to");
  614. if (version !== null && version == "mobile") {
  615. // from mousehunt game mobile version
  616. mhMobilePlatform = true;
  617. setStorage('Platform', 'MHMobile');
  618. }
  619. else {
  620. // from mousehunt game standard version
  621. mhPlatform = true;
  622. setStorage('Platform', 'MH');
  623. }
  624. version = undefined;
  625. }
  626. else if (window.location.href.indexOf("mousehunt.hi5.hitgrab.com") != -1) {
  627. // from hi5
  628. hiFivePlatform = true;
  629. setStorage('Platform', 'Hi5');
  630. }
  631.  
  632. // check if user running in https secure connection
  633. var bSecureConnection = (window.location.href.indexOf("https://") > -1);
  634. g_strHTTP = (bSecureConnection) ? 'https' : 'http';
  635. setStorage('HTTPS', bSecureConnection);
  636.  
  637. if (fbPlatform) {
  638. // alert("This script doesnt work under Facebook MH at this moment");
  639. // return;
  640. if (window.location.href == "http://www.mousehuntgame.com/canvas/" ||
  641. window.location.href == "http://www.mousehuntgame.com/canvas/#" ||
  642. window.location.href == "https://www.mousehuntgame.com/canvas/" ||
  643. window.location.href == "https://www.mousehuntgame.com/canvas/#" ||
  644. window.location.href.indexOf("mousehuntgame.com/canvas/index.php") != -1 ||
  645. window.location.href.indexOf("mousehuntgame.com/canvas/turn.php") != -1 ||
  646. window.location.href.indexOf("mousehuntgame.com/canvas/?newpuzzle") != -1 ||
  647. window.location.href.indexOf("mousehuntgame.com/canvas/?") != -1) {
  648. // page to execute the script!
  649.  
  650. // make sure all the preference already loaded
  651. loadPreferenceSettingFromStorage();
  652.  
  653. // this is the page to execute the script
  654. if (!checkIntroContainer() && retrieveDataFirst()) {
  655. // embed a place where timer show
  656. embedTimer(true);
  657.  
  658. // embed script to horn button
  659. embedScript();
  660.  
  661. // start script action
  662. action();
  663. }
  664. else {
  665. // fail to retrieve data, display error msg and reload the page
  666. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  667. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  668. }
  669. }
  670. else {
  671. // not in huntcamp, just show the title of autobot version
  672. embedTimer(false);
  673. }
  674. }
  675. else if (mhPlatform) {
  676. if (window.location.href == "http://www.mousehuntgame.com/" ||
  677. window.location.href == "http://www.mousehuntgame.com/#" ||
  678. window.location.href == "http://www.mousehuntgame.com/?switch_to=standard" ||
  679. window.location.href == "https://www.mousehuntgame.com/" ||
  680. window.location.href == "https://www.mousehuntgame.com/#" ||
  681. window.location.href == "https://www.mousehuntgame.com/?switch_to=standard" ||
  682. window.location.href.indexOf("mousehuntgame.com/turn.php") != -1 ||
  683. window.location.href.indexOf("mousehuntgame.com/?newpuzzle") != -1 ||
  684. window.location.href.indexOf("mousehuntgame.com/index.php") != -1) {
  685. // page to execute the script!
  686.  
  687. // make sure all the preference already loaded
  688. loadPreferenceSettingFromStorage();
  689.  
  690. // this is the page to execute the script
  691. if (!checkIntroContainer() && retrieveDataFirst()) {
  692. // embed a place where timer show
  693. embedTimer(true);
  694.  
  695. // embed script to horn button
  696. embedScript();
  697.  
  698. // start script action
  699. action();
  700. }
  701. else {
  702. // fail to retrieve data, display error msg and reload the page
  703. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  704. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  705. }
  706. }
  707. else {
  708. // not in huntcamp, just show the title of autobot version
  709. embedTimer(false);
  710. }
  711. }
  712. else if (mhMobilePlatform) {
  713. // execute at all page of mobile version
  714. // page to execute the script!
  715.  
  716. // make sure all the preference already loaded
  717. loadPreferenceSettingFromStorage();
  718.  
  719. // embed a place where timer show
  720. embedTimer(false);
  721. }
  722. else if (hiFivePlatform) {
  723. if (window.location.href == "http://mousehunt.hi5.hitgrab.com/#" ||
  724. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?") != -1 ||
  725. window.location.href == "http://mousehunt.hi5.hitgrab.com/" ||
  726. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/turn.php") != -1 ||
  727. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?newpuzzle") != -1 ||
  728. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/index.php") != -1) {
  729. // page to execute the script!
  730.  
  731. // make sure all the preference already loaded
  732. loadPreferenceSettingFromStorage();
  733.  
  734. // this is the page to execute the script
  735. if (!checkIntroContainer() && retrieveDataFirst()) {
  736. // embed a place where timer show
  737. embedTimer(true);
  738.  
  739. // embed script to horn button
  740. embedScript();
  741.  
  742. // start script action
  743. action();
  744. }
  745. else {
  746. // fail to retrieve data, display error msg and reload the page
  747. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  748. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  749. }
  750. }
  751. else {
  752. // not in huntcamp, just show the title of autobot version
  753. embedTimer(false);
  754. }
  755. }
  756. console.plog("exeScript() End");
  757. }
  758.  
  759. function GetTrapCheckTime(){
  760. try {
  761. var passiveElement = document.getElementsByClassName('passive');
  762. if (passiveElement.length > 0) {
  763. var time = passiveElement[0].textContent;
  764. time = time.substr(time.indexOf('m -') - 4, 2);
  765. setStorage("TrapCheckTimeOffset", time);
  766. return parseInt(time);
  767. }
  768. else throw new Error('passiveElement not found');
  769. }
  770. catch (e) {
  771. console.perror('GetTrapCheckTime',e.message);
  772. var tempStorage = getStorage('TrapCheckTimeOffset');
  773. if (isNullOrUndefined(tempStorage)) {
  774. tempStorage = 0;
  775. setStorage("TrapCheckTimeOffset", tempStorage);
  776. }
  777. return parseInt(tempStorage);
  778. }
  779. }
  780.  
  781. function checkIntroContainer() {
  782. var gotIntroContainerDiv = false;
  783.  
  784. var introContainerDiv = document.getElementById('introContainer');
  785. if (introContainerDiv) {
  786. introContainerDiv = undefined;
  787. gotIntroContainerDiv = true;
  788. }
  789. else {
  790. gotIntroContainerDiv = false;
  791. }
  792.  
  793. try {
  794. return (gotIntroContainerDiv);
  795. }
  796. finally {
  797. gotIntroContainerDiv = undefined;
  798. }
  799. }
  800.  
  801. function notifyMe(notice, icon, body) {
  802. // Let's check if the browser supports notifications
  803. if (!("Notification" in window)) {
  804. alert("This browser does not support desktop notification");
  805. }
  806.  
  807. // Let's check if the user is okay to get some notification
  808. else if (Notification.permission === "granted") {
  809. // If it's okay let's create a notification
  810. var notification = new Notification(notice, { 'icon': icon, 'body': body});
  811. }
  812. // Otherwise, we need to ask the user for permission
  813. // Note, Chrome does not implement the permission static property
  814. // So we have to check for NOT 'denied' instead of 'default'
  815. else if (Notification.permission !== 'denied')
  816. {
  817. Notification.requestPermission(function (permission)
  818. {
  819. // Whatever the user answers, we make sure we store the information
  820. if(!('permission' in Notification)) {
  821. Notification.permission = permission;
  822. }
  823.  
  824. // If the user is okay, let's create a notification
  825. if (permission === "granted") {
  826. var notification = new Notification(notice, { 'icon': icon, 'body': body});
  827. }
  828. });
  829. }
  830. }
  831.  
  832. function getJournalDetail(){
  833. var strLastRecordedJournal = getStorageToVariableStr('LastRecordedJournal', '');
  834. var classJournal = document.getElementsByClassName('journaltext');
  835. var i, j, eleA, strTrap, temp, nIndexStart, nIndexEnd, nIndexCharm, nIndexCheese;
  836. var objResave ={
  837. trinket : false,
  838. bait : false
  839. };
  840. for(i=0;i<classJournal.length;i++){
  841. if(classJournal[i].parentNode.textContent == strLastRecordedJournal)
  842. break;
  843.  
  844. eleA = classJournal[i].getElementsByTagName('a');
  845. if(eleA.length > 0){ // has loot(s)
  846. for(j=0;j<eleA.length;j++){
  847. strTrap = '';
  848. temp = eleA[j].textContent;
  849. if(temp.indexOf('Charm') > -1){
  850. strTrap = 'trinket';
  851. temp = temp.replace(/Charms/, 'Charm');
  852. }
  853. else if(temp.indexOf('Cheese') > -1)
  854. strTrap = 'bait';
  855. temp = temp.replace(/\d+/, '');
  856. temp = temp.trimLeft();
  857. if(strTrap !== '' && objTrapList[strTrap].indexOf(temp) < 0){
  858. console.plog('Add', temp, 'into', strTrap, 'list');
  859. objTrapList[strTrap].unshift(temp);
  860. objResave[strTrap] = true;
  861. }
  862. }
  863. }
  864. else{
  865. nIndexStart = -1;
  866. temp = classJournal[i].textContent.replace(/\./, '');
  867. temp = temp.replace(/Charms/, 'Charm');
  868. temp = temp.split(' ');
  869. if(classJournal[i].textContent.indexOf('crafted') > -1){
  870. nIndexStart = temp.indexOf('crafted');
  871. if(nIndexStart > -1)
  872. nIndexStart += 2;
  873. }
  874. else if(classJournal[i].textContent.indexOf('purchased') > -1){
  875. nIndexStart = temp.indexOf('purchased');
  876. if(nIndexStart > -1)
  877. nIndexStart += 2;
  878. }
  879. if(nIndexStart > -1){
  880. strTrap = '';
  881. nIndexEnd = -1;
  882. nIndexCharm = temp.indexOf('Charm');
  883. nIndexCheese = temp.indexOf('Cheese');
  884. if(nIndexCharm > -1){
  885. strTrap = 'trinket';
  886. nIndexEnd = nIndexCharm + 1;
  887. }
  888. else if(nIndexCheese > -1){
  889. strTrap = 'bait';
  890. nIndexEnd = nIndexCheese + 1;
  891. }
  892. if(strTrap !== '' && nIndexEnd > -1){
  893. temp = temp.slice(nIndexStart, nIndexEnd);
  894. temp = temp.join(' ');
  895. if(temp !== '' && objTrapList[strTrap].indexOf(temp) < 0){
  896. console.plog('Add', temp, 'into', strTrap, 'list');
  897. objTrapList[strTrap].unshift(temp);
  898. objResave[strTrap] = true;
  899. }
  900. }
  901. }
  902. }
  903. }
  904. for (var prop in objResave) {
  905. if(objResave.hasOwnProperty(prop) && objResave[prop] === true)
  906. setStorage("TrapList" + capitalizeFirstLetter(prop), objTrapList[prop].join(","));
  907. }
  908. setStorage('LastRecordedJournal', classJournal[0].parentNode.textContent);
  909. }
  910.  
  911. function getJournalDetailFRift(){
  912. if(g_arrHeirloom.length != 3)
  913. return;
  914. var strLastRecordedJournal = getStorageToVariableStr('LastRecordedJournalFRift', '');
  915. var classJournal = document.getElementsByClassName('journaltext');
  916. var i, j, eleA, temp, nIndex;
  917. for(i=0;i<classJournal.length;i++){
  918. if(classJournal[i].parentNode.textContent == strLastRecordedJournal)
  919. break;
  920. eleA = classJournal[i].getElementsByTagName('a');
  921. if(eleA.length > 0){ // has loot(s)
  922. for(j=0;j<eleA.length;j++){
  923. temp = eleA[j].textContent;
  924. if(temp.indexOf('Chi Belt Heirloom') > -1)
  925. nIndex = 0;
  926. else if(temp.indexOf('Chi Fang Heirloom') > -1)
  927. nIndex = 1;
  928. else if(temp.indexOf('Chi Claw Heirloom') > -1)
  929. nIndex = 2;
  930. else
  931. nIndex = -1;
  932. if(nIndex > -1)
  933. g_arrHeirloom[nIndex]++;
  934. }
  935. }
  936. }
  937. setStorage('LastRecordedJournalFRift', classJournal[0].parentNode.textContent);
  938. }
  939.  
  940. function specialFeature(caller){
  941. return;
  942. var strSpecial = getStorageToVariableStr("SpecialFeature", "None");
  943. console.plog('Special Selected:', strSpecial, 'Call From:', caller);
  944. switch (strSpecial) {
  945. case 'PILLOWCASE':
  946. magicalPillowcase(); break;
  947. default:
  948. break;
  949. }
  950. }
  951.  
  952. function eventLocationCheck(caller) {
  953. var selAlgo = getStorageToVariableStr("eventLocation", "None");
  954. var temp = "";
  955. switch (selAlgo){
  956. case 'Charge Egg 2015':
  957. checkCharge(12); break;
  958. case 'Charge Egg 2015(17)':
  959. checkCharge(17); break;
  960. case 'Charge Egg 2016 Medium + High':
  961. checkCharge2016(chargeMedium); break;
  962. case 'Charge Egg 2016 High':
  963. checkCharge2016(chargeHigh); break;
  964. case 'Burroughs Rift(Red)':
  965. BurroughRift(true, 19, 20); break;
  966. case 'Burroughs Rift(Green)':
  967. BurroughRift(true, 6, 18); break;
  968. case 'Burroughs Rift(Yellow)':
  969. BurroughRift(true, 1, 5); break;
  970. case 'Burroughs Rift Custom':
  971. BRCustom(); break;
  972. case 'Halloween 2016':
  973. Halloween2016(); break;
  974. case 'Iceberg':
  975. iceberg(); break;
  976. case 'WWRift':
  977. wwrift(); break;
  978. case 'GES':
  979. ges(); break;
  980. case 'GWH2016R':
  981. gwh(); break;
  982. case 'All LG Area':
  983. var objLGTemplate = {
  984. isAutoFill : false,
  985. isAutoPour : false,
  986. maxSaltCharged : 25,
  987. base : {
  988. before : '',
  989. after : ''
  990. },
  991. trinket : {
  992. before : '',
  993. after : ''
  994. },
  995. bait : {
  996. before : '',
  997. after : ''
  998. }
  999. };
  1000. var objDefaultLG = {
  1001. LG : JSON.parse(JSON.stringify(objLGTemplate)),
  1002. TG : JSON.parse(JSON.stringify(objLGTemplate)),
  1003. LC : JSON.parse(JSON.stringify(objLGTemplate)),
  1004. CC : JSON.parse(JSON.stringify(objLGTemplate)),
  1005. SD : JSON.parse(JSON.stringify(objLGTemplate)),
  1006. SC : JSON.parse(JSON.stringify(objLGTemplate)),
  1007. };
  1008. temp = getStorageToObject("LGArea", objDefaultLG);
  1009. LGGeneral(temp);
  1010. break;
  1011. case 'SG':
  1012. seasonalGarden(); break;
  1013. case 'ZT':
  1014. zugzwangTower(); break;
  1015. case 'Sunken City':
  1016. SunkenCity(false); break;
  1017. case 'Sunken City Aggro':
  1018. SunkenCity(true); break;
  1019. case 'Sunken City Custom':
  1020. SCCustom(); break;
  1021. case 'Labyrinth':
  1022. labyrinth(); break;
  1023. case 'Zokor':
  1024. zokor(); break;
  1025. case 'Fiery Warpath':
  1026. fw(); break;
  1027. case 'Furoma Rift':
  1028. fRift(); break;
  1029. case 'BC/JOD':
  1030. balackCoveJOD(); break;
  1031. case 'FG/AR':
  1032. forbiddenGroveAR(); break;
  1033. case 'Bristle Woods Rift':
  1034. bwRift(); break;
  1035. case 'Fort Rox':
  1036. fortRox(); break;
  1037. case 'Test':
  1038. checkThenArm('any', 'bait', ['Gouda', 'Brie']);
  1039. break;
  1040. default:
  1041. break;
  1042. }
  1043. }
  1044.  
  1045. function mapHunting(){
  1046. var objDefaultMapHunting = {
  1047. status : false,
  1048. selectedMouse : [],
  1049. logic : 'OR',
  1050. weapon : 'Remain',
  1051. base : 'Remain',
  1052. trinket : 'Remain',
  1053. bait : 'Remain',
  1054. leave : false
  1055. };
  1056. var objMapHunting = getStorageToObject('MapHunting', objDefaultMapHunting);
  1057. var strViewState = getPageVariable('user.quests.QuestRelicHunter.view_state');
  1058. var bHasMap = (strViewState == 'hasMap' || strViewState == 'hasReward');
  1059. if(!objMapHunting.status || !bHasMap || objMapHunting.selectedMouse.length === 0)
  1060. return;
  1061.  
  1062. checkCaughtMouse(objMapHunting);
  1063. }
  1064.  
  1065. function checkCaughtMouse(obj, arrUpdatedUncaught){
  1066. var arrUncaughtMouse = [];
  1067. if(!(Array.isArray(arrUpdatedUncaught)))
  1068. arrUpdatedUncaught = [];
  1069.  
  1070. var bHasReward = (getPageVariable('user.quests.QuestRelicHunter.view_state') == 'hasReward');
  1071. if(!bHasReward && arrUpdatedUncaught.length === 0){
  1072. var nRemaining = -1;
  1073. var classTreasureMap = document.getElementsByClassName('mousehuntHud-userStat treasureMap')[0];
  1074. if(classTreasureMap.children[2].textContent.toLowerCase().indexOf('remaining') > -1)
  1075. nRemaining = parseInt(classTreasureMap.children[2].textContent);
  1076.  
  1077. if(Number.isNaN(nRemaining) || nRemaining == -1)
  1078. return;
  1079.  
  1080. var temp = getStorageToVariableStr('Last Record Uncaught', null);
  1081. if(!isNullOrUndefined(temp))
  1082. arrUncaughtMouse = temp.split(",");
  1083.  
  1084. if(arrUncaughtMouse.length != nRemaining){
  1085. // get updated uncaught mouse list
  1086. arrUncaughtMouse = [];
  1087. var objData = {
  1088. sn : 'Hitgrab',
  1089. hg_is_ajax : 1,
  1090. action : 'info',
  1091. uh : getPageVariable('user.unique_hash')
  1092. };
  1093. if(isNullOrUndefined(getMapPort)){
  1094. // direct call jquery
  1095. ajaxPost(window.location.origin + '/managers/ajax/users/relichunter.php', objData, function (data){
  1096. console.log(data.treasure_map);
  1097. if(!isNullOrUndefined(data.treasure_map.groups)){
  1098. var arrUncaught = [];
  1099. for(var i=0;i<data.treasure_map.groups.length;i++){
  1100. if(data.treasure_map.groups[i].is_uncaught === true){
  1101. for(var j=0;j<data.treasure_map.groups[i].mice.length;j++){
  1102. arrUncaught.push(data.treasure_map.groups[i].mice[j].name);
  1103. }
  1104. }
  1105. }
  1106. if(arrUncaught.length > 0)
  1107. checkCaughtMouse(obj, arrUncaught);
  1108. }
  1109. }, function (error){
  1110. console.error('ajax:',error);
  1111. });
  1112. }
  1113. else{
  1114. getMapPort.postMessage({
  1115. request: "getUncaught",
  1116. data: objData,
  1117. url: window.location.origin + '/managers/ajax/users/relichunter.php',
  1118. objMapHunting : obj
  1119. });
  1120. }
  1121. return;
  1122. }
  1123. }
  1124. else{
  1125. if(bHasReward)
  1126. setStorage('Last Record Uncaught', '');
  1127. else
  1128. setStorage('Last Record Uncaught', arrUpdatedUncaught.join(","));
  1129. arrUncaughtMouse = arrUpdatedUncaught.slice();
  1130. }
  1131.  
  1132. console.plog('Uncaught:', arrUncaughtMouse);
  1133. var i;
  1134. var bChangeTrap = false;
  1135. var bCanLeave = false;
  1136. var arrIndex = [];
  1137. for(i=0;i<obj.selectedMouse.length;i++){
  1138. arrIndex.push(arrUncaughtMouse.indexOf(obj.selectedMouse[i]));
  1139. }
  1140. if(obj.logic == 'AND'){
  1141. bChangeTrap = (countArrayElement(-1, arrIndex) == arrIndex.length || bHasReward);
  1142. }
  1143. else{
  1144. bChangeTrap = (countArrayElement(-1, arrIndex) > 0 || bHasReward);
  1145. }
  1146.  
  1147. bCanLeave = !bHasReward && bChangeTrap;
  1148. if(bChangeTrap){
  1149. for(i=arrIndex.length-1;i>=0;i--){
  1150. if(arrIndex[i] == -1)
  1151. obj.selectedMouse.splice(i,1);
  1152. }
  1153. setStorage('MapHunting', JSON.stringify(obj));
  1154. for (var prop in obj) {
  1155. if(obj.hasOwnProperty(prop) &&
  1156. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')) {
  1157. if(obj[prop] != 'Remain'){
  1158. if(obj[prop] == 'None')
  1159. disarmTrap(prop);
  1160. else
  1161. checkThenArm(null, prop, obj[prop]);
  1162. }
  1163. }
  1164. }
  1165. }
  1166.  
  1167. if(bCanLeave && obj.leave){
  1168. var objData = {
  1169. sn : 'Hitgrab',
  1170. hg_is_ajax : 1,
  1171. action : 'discard',
  1172. uh : getPageVariable('user.unique_hash')
  1173. };
  1174. if(isNullOrUndefined(getMapPort)){
  1175. // direct call jquery
  1176. ajaxPost(window.location.origin + '/managers/ajax/users/relichunter.php', objData, function (data){
  1177. console.plog('Map discarded');
  1178. }, function (error){
  1179. console.perror('ajax discard:',error);
  1180. });
  1181. }
  1182. else{
  1183. getMapPort.postMessage({
  1184. request: "discard",
  1185. data: objData,
  1186. url: window.location.origin + '/managers/ajax/users/relichunter.php',
  1187. });
  1188. }
  1189. }
  1190. }
  1191.  
  1192. function GetCurrentLocation(){
  1193. var loc = getPageVariable('user.location');
  1194. console.plog('Current Location:', loc);
  1195. return loc;
  1196. }
  1197.  
  1198. function bwRift(){
  1199. if (GetCurrentLocation().indexOf("Bristle Woods Rift") < 0)
  1200. return;
  1201.  
  1202. var objDefaultBWRift = {
  1203. order : ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'],
  1204. master : {
  1205. weapon : new Array(32).fill('Mysteriously unYielding'),
  1206. base : new Array(32).fill('Fissure Base'),
  1207. trinket : new Array(32).fill('Rift Vacuum Charm'),
  1208. bait : new Array(32).fill('Brie String'),
  1209. activate : new Array(32).fill(false),
  1210. },
  1211. specialActivate : {
  1212. forceActivate : new Array(32).fill(false),
  1213. remainingLootActivate : new Array(32).fill(1),
  1214. forceDeactivate : new Array(32).fill(false),
  1215. remainingLootDeactivate : new Array(32).fill(1)
  1216. },
  1217. gw : {
  1218. weapon : new Array(4).fill('MASTER'),
  1219. base : new Array(4).fill('MASTER'),
  1220. trinket : new Array(4).fill('MASTER'),
  1221. bait : new Array(4).fill('MASTER'),
  1222. activate : new Array(4).fill('MASTER'),
  1223. },
  1224. al : {
  1225. weapon : new Array(4).fill('MASTER'),
  1226. base : new Array(4).fill('MASTER'),
  1227. trinket : new Array(4).fill('MASTER'),
  1228. bait : new Array(4).fill('MASTER'),
  1229. activate : new Array(4).fill('MASTER'),
  1230. },
  1231. rl : {
  1232. weapon : new Array(4).fill('MASTER'),
  1233. base : new Array(4).fill('MASTER'),
  1234. trinket : new Array(4).fill('MASTER'),
  1235. bait : new Array(4).fill('MASTER'),
  1236. activate : new Array(4).fill('MASTER'),
  1237. },
  1238. gb : {
  1239. weapon : new Array(14).fill('MASTER'),
  1240. base : new Array(14).fill('MASTER'),
  1241. trinket : new Array(14).fill('MASTER'),
  1242. bait : new Array(14).fill('MASTER'),
  1243. activate : new Array(14).fill('MASTER'),
  1244. },
  1245. ic : {
  1246. weapon : new Array(8).fill('MASTER'),
  1247. base : new Array(8).fill('MASTER'),
  1248. trinket : new Array(8).fill('MASTER'),
  1249. bait : new Array(8).fill('MASTER'),
  1250. activate : new Array(8).fill('MASTER'),
  1251. },
  1252. fa : {
  1253. weapon : new Array(32).fill('MASTER'),
  1254. base : new Array(32).fill('MASTER'),
  1255. trinket : new Array(32).fill('MASTER'),
  1256. bait : new Array(32).fill('MASTER'),
  1257. activate : new Array(32).fill('MASTER'),
  1258. },
  1259. choosePortal : false,
  1260. choosePortalAfterCC : false,
  1261. priorities : ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  1262. prioritiesCursed : ['SECURITY', 'FURNACE', 'PURSUER', 'ANCIENT', 'GEARWORKS', 'RUNIC', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  1263. minTimeSand : [70,70,50,50,50,50,40,40,999],
  1264. minRSCType : 'NUMBER',
  1265. minRSC : 0,
  1266. enterMinigameWCurse : false
  1267. };
  1268.  
  1269. var objBWRift = getStorageToObject('BWRift', objDefaultBWRift);
  1270. var objUser = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestRiftBristleWoods)'));
  1271. var nIndex = -1;
  1272. var nLootRemaining = objUser.progress_remaining;
  1273. var nTimeSand = parseInt(objUser.items.rift_hourglass_sand_stat_item.quantity);
  1274. var strChamberName = objUser.chamber_name.split(' ')[0].toUpperCase();
  1275. var strTestName = objUser.chamber_name.toUpperCase();
  1276. if(strTestName.indexOf('LUCK') > -1)
  1277. strChamberName = 'LUCKY';
  1278. if(strChamberName == 'ACOLYTE'){ // in Acolyte Chamber
  1279. var strStatus;
  1280. if(objUser.minigame.acolyte_chamber.obelisk_charge < 100){
  1281. strStatus = 'ACOLYTE_CHARGING';
  1282. nLootRemaining = 100 - objUser.minigame.acolyte_chamber.obelisk_charge;
  1283. }
  1284. else if(objUser.minigame.acolyte_chamber.acolyte_sand > 0){
  1285. strStatus = 'ACOLYTE_DRAINING';
  1286. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1287. }
  1288. else{
  1289. strStatus = 'ACOLYTE_DRAINED';
  1290. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1291. }
  1292. console.plog('Status:',strStatus,'Obelisk:',objUser.minigame.acolyte_chamber.obelisk_charge,'Acolyte Sand:',objUser.minigame.acolyte_chamber.acolyte_sand);
  1293. nIndex = objBWRift.order.indexOf(strStatus);
  1294. }
  1295. else if(strChamberName == 'RIFT')
  1296. nIndex = 0;
  1297. else{
  1298. if(nLootRemaining > 0)
  1299. nIndex = objBWRift.order.indexOf(strChamberName);
  1300. else
  1301. nIndex = 0;
  1302. }
  1303. console.plog('Status:', objUser.chamber_status, 'Name:', objUser.chamber_name, 'Shortname:', strChamberName, 'Index:', nIndex, 'Remaining Loot:', nLootRemaining, 'Time Sand:', nTimeSand);
  1304. if(nIndex < 0)
  1305. return;
  1306. var nIndexBuffCurse = 0;
  1307. if(!(objUser.status_effects.un.indexOf('default') > -1 || objUser.status_effects.un.indexOf('remove') > -1) ||
  1308. !(objUser.status_effects.fr.indexOf('default') > -1 || objUser.status_effects.fr.indexOf('remove') > -1) ||
  1309. !(objUser.status_effects.st.indexOf('default') > -1 || objUser.status_effects.st.indexOf('remove') > -1))
  1310. nIndexBuffCurse = 8;
  1311. else{
  1312. if(objUser.status_effects.ng.indexOf('default') < 0)
  1313. nIndexBuffCurse |= 0x04;
  1314. if(objUser.status_effects.ac.indexOf('default') < 0)
  1315. nIndexBuffCurse |= 0x02;
  1316. if(objUser.status_effects.ex.indexOf('default') < 0)
  1317. nIndexBuffCurse |= 0x01;
  1318. }
  1319. console.plog('Buff & Curse Index:', nIndexBuffCurse, 'Obj:', objUser.status_effects);
  1320. if(nIndex === 0 || objUser.chamber_status == 'open'){
  1321. var classPortalContainer = document.getElementsByClassName('riftBristleWoodsHUD-portalContainer');
  1322. if(classPortalContainer.length > 0){
  1323. var objPortal = {
  1324. arrName : new Array(classPortalContainer[0].children.length).fill(''),
  1325. arrIndex : new Array(classPortalContainer[0].children.length).fill(Number.MAX_SAFE_INTEGER)
  1326. };
  1327. var i,j;
  1328. var arrPriorities = (nIndexBuffCurse == 8) ? objBWRift.prioritiesCursed : objBWRift.priorities;
  1329. var nIndexCustom = -1;
  1330. for(i=0;i<arrPriorities.length;i++){
  1331. if(arrPriorities[i].indexOf('AL/RL') > -1){
  1332. nIndexCustom = i;
  1333. break;
  1334. }
  1335. }
  1336. for(i=0;i<objPortal.arrName.length;i++){
  1337. objPortal.arrName[i] = classPortalContainer[0].children[i].getElementsByClassName('riftBristleWoodsHUD-portal-name')[0].textContent;
  1338. strTestName = objPortal.arrName[i].toUpperCase();
  1339. if(strTestName.indexOf('LUCK') > -1)
  1340. objPortal.arrName[i] = 'LUCKY';
  1341. else if(strTestName.indexOf('HIDDEN') > -1 || strTestName.indexOf('TREASUR') > -1)
  1342. objPortal.arrName[i] = 'HIDDEN';
  1343. objPortal.arrName[i] = objPortal.arrName[i].split(' ')[0].toUpperCase();
  1344. objPortal.arrIndex[i] = arrPriorities.indexOf(objPortal.arrName[i]);
  1345. if(nIndexCustom > -1 && (objPortal.arrName[i] == 'ANCIENT' || objPortal.arrName[i] == 'RUNIC')){
  1346. if(objPortal.arrIndex[i] < 0 || nIndexCustom < objPortal.arrIndex[i])
  1347. objPortal.arrIndex[i] = nIndexCustom;
  1348. }
  1349. if(objPortal.arrIndex[i] < 0)
  1350. objPortal.arrIndex[i] = Number.MAX_SAFE_INTEGER;
  1351. }
  1352. console.plog(objPortal);
  1353. if(objBWRift.choosePortal){
  1354. if(nIndex === 0 || (nIndex > 0 && objUser.chamber_status == 'open' && objBWRift.choosePortalAfterCC)){
  1355. var nIndexOld = nIndex;
  1356. var arrIndices = [];
  1357. var nRSCPot = parseInt(objUser.items.runic_string_cheese_potion.quantity);
  1358. var nRSC = parseInt(objUser.items.runic_string_cheese.quantity);
  1359. var nTotalRSC = nRSC+nRSCPot*2;
  1360. var nIndexTemp = objPortal.arrName.indexOf('ACOLYTE');
  1361. if(nIndexTemp > -1){
  1362. if(!Number.isInteger(nTotalRSC))
  1363. nTotalRSC = Number.MAX_SAFE_INTEGER;
  1364. console.plog('RSC Pot:', nRSCPot, 'RSC:', nRSC, 'Total RSC:', nTotalRSC);
  1365. var nMinRSC = -1;
  1366. if(objBWRift.minRSCType == 'NUMBER')
  1367. nMinRSC = objBWRift.minRSC;
  1368. else if(objBWRift.minRSCType == 'GEQ')
  1369. nMinRSC = objBWRift.minTimeSand[nIndexBuffCurse];
  1370. if(nTotalRSC < nMinRSC || nTimeSand < objBWRift.minTimeSand[nIndexBuffCurse]){
  1371. arrIndices = getAllIndices(objPortal.arrName, 'ACOLYTE');
  1372. for(i=0;i<arrIndices.length;i++)
  1373. objPortal.arrIndex[arrIndices[i]] = Number.MAX_SAFE_INTEGER;
  1374. }
  1375. }
  1376. var arrTemp = ['TIMEWARP', 'GUARD'];
  1377. for(i=0;i<arrTemp.length;i++){
  1378. nIndexTemp = objPortal.arrName.indexOf(arrTemp[i]);
  1379. if(nIndexTemp > -1 && nTimeSand >= objBWRift.minTimeSand[nIndexBuffCurse]){
  1380. arrIndices = getAllIndices(objPortal.arrName, arrTemp[i]);
  1381. for(j=0;j<arrIndices.length;j++)
  1382. objPortal.arrIndex[arrIndices[j]] = Number.MAX_SAFE_INTEGER;
  1383. }
  1384. }
  1385. arrTemp = ['GUARD', 'FROZEN', 'INGRESS'];
  1386. for(i=0;i<arrTemp.length;i++){
  1387. nIndexTemp = objPortal.arrName.indexOf(arrTemp[i]);
  1388. if(nIndexTemp > -1 && nIndexBuffCurse == 8 && objBWRift.enterMinigameWCurse === false){
  1389. arrIndices = getAllIndices(objPortal.arrName, arrTemp[i]);
  1390. for(j=0;j<arrIndices.length;j++)
  1391. objPortal.arrIndex[arrIndices[j]] = Number.MAX_SAFE_INTEGER;
  1392. }
  1393. }
  1394. var arrAL = getAllIndices(objPortal.arrName, 'ANCIENT');
  1395. var arrRL = getAllIndices(objPortal.arrName, 'RUNIC');
  1396. if(arrAL.length > 0 && arrRL.length > 0 && nIndexCustom > -1){
  1397. var nASCPot = parseInt(objUser.items.ancient_string_cheese_potion.quantity);
  1398. var nASC = parseInt(objUser.items.ancient_string_cheese.quantity);
  1399. var nTotalASC = nASCPot + nASC;
  1400. if(arrPriorities[nIndexCustom].indexOf('MSC') > -1)
  1401. nTotalASC += nASCPot;
  1402. console.plog('ASC Pot:', nASCPot, 'ASC:', nASC, 'Total ASC:', nTotalASC, 'RSC Pot:', nRSCPot, 'RSC:', nRSC, 'Total RSC:', nTotalRSC);
  1403. if(nTotalASC < nTotalRSC){ // ancient first
  1404. for(j=0;j<arrRL.length;j++)
  1405. objPortal.arrIndex[arrRL[j]] = Number.MAX_SAFE_INTEGER;
  1406. }
  1407. else{ // runic first
  1408. for(j=0;j<arrAL.length;j++)
  1409. objPortal.arrIndex[arrAL[j]] = Number.MAX_SAFE_INTEGER;
  1410. }
  1411. }
  1412. nIndexTemp = objPortal.arrName.indexOf('ENTER');
  1413. if(nIndexTemp > -1)
  1414. objPortal.arrIndex[nIndexTemp] = 1;
  1415. console.plog(objPortal);
  1416. var nMinIndex = minIndex(objPortal.arrIndex);
  1417. if(objPortal.arrIndex[nMinIndex] == Number.MAX_SAFE_INTEGER || classPortalContainer[0].children[nMinIndex] == 'frozen')
  1418. nIndex = nIndexOld;
  1419. else{
  1420. if(objPortal.arrName[nMinIndex] == 'ACOLYTE'){
  1421. console.plog('Chosen Portal:',objPortal.arrName[nMinIndex],'Index: Unknown');
  1422. fireEvent(classPortalContainer[0].children[nMinIndex], 'click');
  1423. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small')[1], 'click'); }, 1000);
  1424. window.setTimeout(function () { bwRift(); }, 2000);
  1425. return;
  1426. }
  1427. if(objPortal.arrName[nMinIndex] == 'ENTER')
  1428. nIndex = objBWRift.order.indexOf('GEARWORKS');
  1429. else
  1430. nIndex = objBWRift.order.indexOf(objPortal.arrName[nMinIndex]);
  1431. if(nIndex > -1){
  1432. console.plog('Chosen Portal:',objPortal.arrName[nMinIndex],'Index:', nIndex);
  1433. strChamberName = objBWRift.order[nIndex];
  1434. fireEvent(classPortalContainer[0].children[nMinIndex], 'click');
  1435. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small')[1], 'click'); }, 1000);
  1436. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1437. }
  1438. else
  1439. nIndex = nIndexOld;
  1440. }
  1441. }
  1442. }
  1443. }
  1444. }
  1445. var objTemp = {
  1446. weapon : '',
  1447. base : '',
  1448. trinket : '',
  1449. bait : '',
  1450. activate : false
  1451. };
  1452. if(nIndex === 0)
  1453. strChamberName = 'NONE';
  1454. if(nIndexBuffCurse == 8)
  1455. nIndex += 16;
  1456. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  1457. var nCleaverAvailable = (objUser.cleaver_status == 'available') ? 1 : 0;
  1458. console.plog('Cleaver Available Status:',nCleaverAvailable);
  1459. var strTemp = '';
  1460. if(strChamberName == 'GEARWORKS')
  1461. strTemp = 'gw';
  1462. else if(strChamberName == 'ANCIENT')
  1463. strTemp = 'al';
  1464. else
  1465. strTemp = 'rl';
  1466. if(nIndexBuffCurse == 8)
  1467. nCleaverAvailable += 2;
  1468. for (var prop in objTemp) {
  1469. if(objTemp.hasOwnProperty(prop))
  1470. objTemp[prop] = (objBWRift[strTemp][prop][nCleaverAvailable] == 'MASTER') ? objBWRift.master[prop][nIndex] : objBWRift[strTemp][prop][nCleaverAvailable];
  1471. }
  1472. }
  1473. else if(strChamberName == 'GUARD'){
  1474. var nAlertLvl = (isNullOrUndefined(objUser.minigame.guard_chamber)) ? -1 : parseInt(objUser.minigame.guard_chamber.status.split("_")[1]);
  1475. console.plog('Guard Barracks Alert Lvl:',nAlertLvl);
  1476. if(Number.isNaN(nAlertLvl) || nAlertLvl < 0 || nAlertLvl > 6){
  1477. for (var prop in objTemp) {
  1478. if(objTemp.hasOwnProperty(prop))
  1479. objTemp[prop] = objBWRift.master[prop][nIndex];
  1480. }
  1481. }
  1482. else{
  1483. if(nIndexBuffCurse == 8)
  1484. nAlertLvl += 7;
  1485. for (var prop in objTemp) {
  1486. if(objTemp.hasOwnProperty(prop))
  1487. objTemp[prop] = (objBWRift.gb[prop][nAlertLvl] == 'MASTER') ? objBWRift.master[prop][nIndex] : objBWRift.gb[prop][nAlertLvl];
  1488. }
  1489. }
  1490. }
  1491. /*else if(strChamberName == 'INGRESS'){
  1492. }
  1493. else if(strChamberName == 'FROZEN'){
  1494. }*/
  1495. else{
  1496. for (var prop in objTemp) {
  1497. if(objTemp.hasOwnProperty(prop))
  1498. objTemp[prop] = objBWRift.master[prop][nIndex];
  1499. }
  1500. }
  1501.  
  1502. checkThenArm(null, 'weapon', objTemp.weapon);
  1503. checkThenArm(null, 'base', objTemp.base);
  1504. checkThenArm(null, 'trinket', objTemp.trinket);
  1505. if(objTemp.bait == 'Runic/Ancient')
  1506. checkThenArm('any', 'bait', ['Runic String Cheese', 'Ancient String Cheese']);
  1507. else if(objTemp.bait == 'Runic=>Ancient')
  1508. checkThenArm('best', 'bait', ['Runic String Cheese', 'Ancient String Cheese']);
  1509. else
  1510. checkThenArm(null, 'bait', objTemp.bait);
  1511. var classLootBooster = document.getElementsByClassName('riftBristleWoodsHUD-portalEquipment lootBooster mousehuntTooltipParent')[0];
  1512. var bPocketwatchActive = (classLootBooster.getAttribute('class').indexOf('selected') > -1);
  1513. var classButton = classLootBooster.getElementsByClassName('riftBristleWoodsHUD-portalEquipment-action')[0];
  1514. var bForce = false;
  1515. var bToggle = false;
  1516. if(objTemp.activate){
  1517. bForce = (objBWRift.specialActivate.forceDeactivate[nIndex] && nLootRemaining <= objBWRift.specialActivate.remainingLootDeactivate[nIndex]);
  1518. if(bForce === bPocketwatchActive)
  1519. bToggle = true;
  1520. }
  1521. else{
  1522. bForce = (objBWRift.specialActivate.forceActivate[nIndex] && nLootRemaining <= objBWRift.specialActivate.remainingLootActivate[nIndex]);
  1523. if(bForce !== bPocketwatchActive)
  1524. bToggle = true;
  1525. }
  1526. console.plog('QQ Activated:', bPocketwatchActive, 'Activate?:', objTemp.activate, 'Force:', bForce, 'Toggle:', bToggle);
  1527. if(bToggle){
  1528. var nRetry = 5;
  1529. var intervalPocket = setInterval( function () {
  1530. if (classLootBooster.getAttribute('class').indexOf('chamberEmpty') < 0 || --nRetry <= 0){
  1531. fireEvent(classButton, 'click');
  1532. clearInterval(intervalPocket);
  1533. intervalPocket = null;
  1534. }
  1535. }, 1000);
  1536. }
  1537. }
  1538.  
  1539. function fortRox(){
  1540. if (GetCurrentLocation().indexOf("Fort Rox") < 0)
  1541. return;
  1542.  
  1543. var objDefaultFRox = {
  1544. stage : ['DAY','stage_one','stage_two','stage_three','stage_four','stage_five','DAWN'],
  1545. order : ['DAY','TWILIGHT','MIDNIGHT','PITCH','UTTER','FIRST','DAWN'],
  1546. weapon : new Array(7).fill(''),
  1547. base : new Array(7).fill(''),
  1548. trinket : new Array(7).fill('None'),
  1549. bait : new Array(7).fill('Gouda'),
  1550. activate : new Array(7).fill(false),
  1551. fullHPDeactivate : true
  1552. };
  1553.  
  1554. var objFRox = getStorageToObject('FRox', objDefaultFRox);
  1555. var objUser = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestFortRox)'));
  1556. var nIndex = -1;
  1557. if(objUser.is_dawn === true){
  1558. nIndex = 6;
  1559. console.plog('In Dawn');
  1560. }
  1561. else if(objUser.current_phase == 'night'){
  1562. nIndex = objFRox.stage.indexOf(objUser.current_stage);
  1563. console.plog('In Night, Current Stage:', objUser.current_stage);
  1564. }
  1565. else if(objUser.current_phase == 'day'){
  1566. nIndex = 0;
  1567. console.plog('In Day');
  1568. }
  1569.  
  1570. if(nIndex < 0)
  1571. return;
  1572. checkThenArm(null, 'weapon', objFRox.weapon[nIndex]);
  1573. checkThenArm(null, 'base', objFRox.base[nIndex]);
  1574. checkThenArm(null, 'trinket', objFRox.trinket[nIndex]);
  1575. if(objFRox.bait[nIndex] == 'ANY_LUNAR')
  1576. checkThenArm('any', 'bait', ['Moon Cheese', 'Crescent Cheese']);
  1577. else if(objFRox.bait[nIndex].indexOf('=>') > -1){
  1578. var arr = objFRox.bait[nIndex].split('=>');
  1579. checkThenArm('best', 'bait', arr);
  1580. }
  1581. else
  1582. checkThenArm(null, 'bait', objFRox.bait[nIndex]);
  1583.  
  1584. var bTowerActive = !(objUser.tower_status.indexOf('inactive') > -1);
  1585. var nMana = parseInt(document.getElementsByClassName('fortRoxHUD-mana quantity')[0].textContent);
  1586. console.plog('Tower Active:', bTowerActive, 'Mana:', nMana, 'Current HP:', objUser.hp, 'Max HP:', objUser.max_hp);
  1587. if(nMana > 0 && nIndex > 0){
  1588. var classButton = document.getElementsByClassName('fortRoxHUD-spellTowerButton')[0];
  1589. if(bTowerActive){
  1590. if(objFRox.activate[nIndex]){
  1591. if(objFRox.fullHPDeactivate && objUser.hp >= objUser.max_hp){
  1592. // deactivate tower
  1593. fireEvent(classButton, 'click');
  1594. }
  1595. }
  1596. else{
  1597. //deactivate tower
  1598. fireEvent(classButton, 'click');
  1599. }
  1600. }
  1601. else{
  1602. if(objFRox.activate[nIndex]){
  1603. //activate tower
  1604. fireEvent(classButton, 'click');
  1605. }
  1606. }
  1607. }
  1608. }
  1609.  
  1610. function Halloween2016(){
  1611. if (GetCurrentLocation().indexOf("Spooky Sandcastle") < 0)
  1612. return;
  1613.  
  1614. var areaName = document.getElementsByClassName('halloweenHud-areaDetails-name')[0].innerHTML;
  1615. var warning = document.getElementsByClassName('halloweenHud-areaDetails-warning active').length;
  1616. var isWarning = (warning > 0);
  1617. var trickContainer = document.getElementsByClassName('halloweenHud-bait trick_cheese clear-block')[0];
  1618. var treatContainer = document.getElementsByClassName('halloweenHud-bait treat_cheese clear-block')[0];
  1619. var bTricking = (trickContainer.children[2].getAttribute('class') == 'armNow active');
  1620. var bTreating = (treatContainer.children[2].getAttribute('class') == 'armNow active');
  1621. console.plog('Current Area Name:', areaName, 'Warning:', isWarning, 'Tricking:', bTricking, 'Treating:', bTreating);
  1622. if(!(bTricking || bTreating))
  1623. return;
  1624. if (isWarning){
  1625. if (bTricking){
  1626. if(parseInt(treatContainer.children[1].textContent) > 0)
  1627. fireEvent(treatContainer.children[2], 'click');
  1628. else{
  1629. disarmTrap('trinket');
  1630. checkThenArm(null, 'bait', 'Brie Cheese');
  1631. }
  1632. }
  1633. else{
  1634. if(parseInt(trickContainer.children[1].textContent) > 0)
  1635. fireEvent(trickContainer.children[2], 'click');
  1636. else{
  1637. disarmTrap('trinket');
  1638. checkThenArm(null, 'bait', 'Brie Cheese');
  1639. }
  1640. }
  1641. }
  1642. else{
  1643. var i;
  1644. var nSquareMin = 0;
  1645. var classContent = document.getElementsByClassName('halloweenHud-trinket-content clear-block');
  1646. for(i=0;i<classContent.length;i+=3){
  1647. if(classContent[i].children[3].getAttribute('class').indexOf('armNow active') > -1)
  1648. nSquareMin++;
  1649. }
  1650. if(nSquareMin === 0)
  1651. return;
  1652. i = (areaName.indexOf('Haunted Dream') > -1) ? 0 : 1 ;
  1653. var stageContainer = document.getElementsByClassName('halloweenHud-progress-stage-row-container')[i];
  1654. i = (bTricking) ? 0 : 1 ;
  1655. var nSquareLeft = stageContainer.children[i].getElementsByTagName('i').length;
  1656. console.plog('Min Square:', nSquareMin, 'Square Left:', nSquareLeft);
  1657. if(nSquareLeft <= nSquareMin){
  1658. for(i=0;i<classContent.length;i+=3){
  1659. if(classContent[i].children[3].getAttribute('class').indexOf('armNow active') > -1)
  1660. fireEvent(classContent[i].children[3], 'click');
  1661. }
  1662. }
  1663.  
  1664. }
  1665. }
  1666.  
  1667. function ges(){
  1668. if(GetCurrentLocation().indexOf('Gnawnian Express Station') < 0)
  1669. return;
  1670.  
  1671. var i, j;
  1672. var bOnTrain = (getPageVariable('user.quests.QuestTrainStation.on_train') == 'true');
  1673. var charmArmed = getPageVariable("user.trinket_name");
  1674. var arrCharm;
  1675. var nCharmQuantity;
  1676. var objDefaultGES = {
  1677. bLoadCrate : false,
  1678. nMinCrate : 11,
  1679. bUseRepellent : false,
  1680. nMinRepellent : 11,
  1681. bStokeEngine : false,
  1682. nMinFuelNugget : 20,
  1683. SD_BEFORE : {
  1684. weapon : '',
  1685. base : '',
  1686. trinket : '',
  1687. bait : ''
  1688. },
  1689. SD_AFTER : {
  1690. weapon : '',
  1691. base : '',
  1692. trinket : '',
  1693. bait : ''
  1694. },
  1695. RR : {
  1696. weapon : '',
  1697. base : '',
  1698. trinket : '',
  1699. bait : ''
  1700. },
  1701. DC : {
  1702. weapon : '',
  1703. base : '',
  1704. trinket : '',
  1705. bait : ''
  1706. },
  1707. WAITING : {
  1708. weapon : '',
  1709. base : '',
  1710. trinket : '',
  1711. bait : ''
  1712. }
  1713. };
  1714. var objGES = getStorageToObject('GES', objDefaultGES);
  1715. var nPhaseSecLeft = parseInt(getPageVariable('user.quests.QuestTrainStation.phase_seconds_remaining'));
  1716. var strCurrentPhase = '';
  1717. if(!bOnTrain){
  1718. strCurrentPhase = 'WAITING';
  1719. }
  1720. else{
  1721. var classPhase = document.getElementsByClassName('box phaseName');
  1722. if(classPhase.length > 0 && classPhase[0].children.length > 1)
  1723. strCurrentPhase = classPhase[0].children[1].textContent;
  1724. }
  1725. console.plog('Current Phase:', strCurrentPhase, 'Time Left (s):', nPhaseSecLeft);
  1726. if(strCurrentPhase === '')
  1727. return;
  1728.  
  1729. var strStage = '';
  1730. if(strCurrentPhase.indexOf('Supply Depot') > -1 ){
  1731. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1732. strStage = 'RR';
  1733. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1734. }
  1735. else{
  1736. var nTurn = parseInt(document.getElementsByClassName('supplyHoarderTab')[0].textContent.substr(0, 1));
  1737. console.plog("Supply Hoarder Turn:", nTurn);
  1738. if(nTurn <= 0){ // before
  1739. strStage = 'SD_BEFORE';
  1740. if(objGES.SD_BEFORE.trinket.indexOf('Supply Schedule') > -1 && charmArmed.indexOf('Supply Schedule') < 0){
  1741. var classCharm = document.getElementsByClassName('charms');
  1742. var linkCharm = classCharm[0].children[0];
  1743. nCharmQuantity = parseInt(document.getElementsByClassName('charms')[0].getElementsByClassName('quantity')[0].textContent);
  1744. console.plog('Supply Schedule Charm Quantity:', nCharmQuantity);
  1745. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0)
  1746. fireEvent(linkCharm, 'click');
  1747. }
  1748. else
  1749. checkThenArm(null, 'trinket', objGES.SD_BEFORE.trinket);
  1750. }
  1751. else{
  1752. strStage = 'SD_AFTER';
  1753. if(objGES.SD_AFTER.trinket.indexOf('Supply Schedule') > -1)
  1754. disarmTrap('trinket');
  1755. else
  1756. checkThenArm(null, 'trinket', objGES.SD_AFTER.trinket);
  1757. }
  1758. }
  1759.  
  1760. if(objGES.bLoadCrate){
  1761. var nCrateQuantity = parseInt(document.getElementsByClassName('supplyCrates')[0].getElementsByClassName('quantity')[0].textContent);
  1762. console.plog('Crate Quantity:', nCrateQuantity);
  1763. if(Number.isInteger(nCrateQuantity) && nCrateQuantity >= objGES.nMinCrate)
  1764. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1765. }
  1766. }
  1767. else if(strCurrentPhase.indexOf('Raider River') > -1 ){
  1768. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1769. strStage = 'DC';
  1770. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1771. }
  1772. else{
  1773. strStage = 'RR';
  1774. if(objGES.RR.trinket == 'AUTO'){
  1775. // get raider status and arm respective charm
  1776. arrCharm = ['Roof Rack', 'Door Guard', 'Greasy Glob'];
  1777. var classTrainCarArea = document.getElementsByClassName('trainCarArea');
  1778. nCharmQuantity = 0;
  1779. var strAttack = '';
  1780. for (i=0;i<classTrainCarArea.length;i++) {
  1781. if(classTrainCarArea[i].className.indexOf('attacked') > -1){
  1782. strAttack = classTrainCarArea[i].className.substr(0, classTrainCarArea[i].className.indexOf(' '));
  1783. nCharmQuantity = parseInt(classTrainCarArea[i].getElementsByClassName('quantity')[0].textContent);
  1784. console.plog('Raiders Attack:', capitalizeFirstLetter(strAttack), ',', arrCharm[i], 'Charm Quantity:', nCharmQuantity);
  1785. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0 && charmArmed.indexOf(arrCharm[i]) < 0)
  1786. fireEvent(classTrainCarArea[i].firstChild, 'click');
  1787. else{
  1788. for(j=0;j<arrCharm.length;j++){
  1789. if(j!=i && charmArmed.indexOf(arrCharm[j]) > -1){
  1790. disarmTrap('trinket');
  1791. break;
  1792. }
  1793. }
  1794. }
  1795. break;
  1796. }
  1797. }
  1798. }
  1799. else
  1800. checkThenArm(null, 'trinket', objGES.RR.trinket);
  1801. }
  1802.  
  1803. if(objGES.bUseRepellent){
  1804. var nRepellentQuantity = parseInt(document.getElementsByClassName('mouseRepellent')[0].getElementsByClassName('quantity')[0].textContent);
  1805. console.plog('Repellent Quantity:', nRepellentQuantity);
  1806. if(Number.isInteger(nRepellentQuantity) && nRepellentQuantity >= objGES.nMinRepellent)
  1807. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1808. }
  1809. }
  1810. else if(strCurrentPhase.indexOf('Daredevil Canyon') > -1 ){
  1811. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1812. strStage = 'WAITING';
  1813. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1814. }
  1815. else{
  1816. strStage = 'DC';
  1817. arrCharm = ['Magmatic Crystal Charm', 'Black Powder Charm', 'Dusty Coal Charm'];
  1818. if(objGES.DC.trinket == 'AUTO')
  1819. checkThenArm('best', 'trinket', arrCharm);
  1820. else{
  1821. arrCharm.reverse();
  1822. var nIndex = arrCharm.indexOf(objGES.DC.trinket);
  1823. if(arrCharm.indexOf(objGES.DC.trinket) > -1){
  1824. var classCharms = document.getElementsByClassName('charms');
  1825. nCharmQuantity = parseInt(classCharms[0].children[nIndex].getElementsByClassName('quantity')[0].textContent);
  1826. console.plog(objGES.DC.trinket, 'Quantity:', nCharmQuantity);
  1827. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0 && charmArmed.indexOf(objGES.DC.trinket) < 0)
  1828. fireEvent(classCharms[0].children[nIndex], 'click');
  1829. }
  1830. else
  1831. checkThenArm(null, 'trinket', objGES.DC.trinket);
  1832. }
  1833. }
  1834.  
  1835. if(objGES.bStokeEngine){
  1836. // get fuel nugget quantity
  1837. var nFuelQuantity = parseInt(document.getElementsByClassName('fuelNugget')[0].getElementsByClassName('quantity')[0].textContent);
  1838. console.plog('Fuel Nugget Quantity:', nFuelQuantity);
  1839. if(Number.isInteger(nFuelQuantity) && nFuelQuantity >= objGES.nMinFuelNugget)
  1840. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1841. }
  1842. }
  1843. else{
  1844. strStage = 'WAITING';
  1845. arrCharm = ['Supply Schedule', 'Roof Rack', 'Door Guard', 'Greasy Blob', 'Magmatic Crystal', 'Black Powder', 'Dusty Coal'];
  1846. if(objGES.WAITING.trinket.indexOf(arrCharm) > -1)
  1847. disarmTrap('trinket');
  1848. else
  1849. checkThenArm(null, 'trinket', objGES.WAITING.trinket);
  1850. }
  1851. checkThenArm(null, 'weapon', objGES[strStage].weapon);
  1852. checkThenArm(null, 'base', objGES[strStage].base);
  1853. checkThenArm(null, 'bait', objGES[strStage].bait);
  1854. }
  1855.  
  1856. function wwrift(){
  1857. if(GetCurrentLocation().indexOf('Whisker Woods Rift') < 0)
  1858. return;
  1859.  
  1860. var objDefaultWWRift = {
  1861. factionFocus : "CC",
  1862. factionFocusNext : "Remain",
  1863. faction : {
  1864. weapon : new Array(3).fill(''),
  1865. base : new Array(3).fill(''),
  1866. trinket : new Array(3).fill('None'),
  1867. bait : new Array(3).fill('None')
  1868. },
  1869. MBW : {
  1870. minRageLLC : 40,
  1871. rage4044: {
  1872. weapon : new Array(7).fill(''),
  1873. base : new Array(7).fill(''),
  1874. trinket : new Array(7).fill('None'),
  1875. bait : new Array(7).fill('None')
  1876. },
  1877. rage4548: {
  1878. weapon : new Array(8).fill(''),
  1879. base : new Array(8).fill(''),
  1880. trinket : new Array(8).fill('None'),
  1881. bait : new Array(8).fill('None')
  1882. },
  1883. },
  1884. };
  1885. var objWWRift = getStorageToObject('WWRift', objDefaultWWRift);
  1886. if(isNullOrUndefined(objWWRift.factionFocusNext) || objWWRift.factionFocus === "")
  1887. objWWRift.factionFocusNext = "Remain";
  1888. objWWRift.order = ['CC', 'GGT', 'DL'];
  1889. objWWRift.funnelCharm = ['Cherry Charm', 'Gnarled Charm', 'Stagnant Charm'];
  1890. objWWRift.rage = new Array(3);
  1891. var i;
  1892. var temp = -1;
  1893. var tempNext = -1;
  1894. var nIndex = -1;
  1895. var classRage = document.getElementsByClassName('riftWhiskerWoodsHUD-zone-rageLevel');
  1896. for(i=0;i<classRage.length;i++){
  1897. objWWRift.rage[i] = parseInt(classRage[i].textContent);
  1898. if(Number.isNaN(objWWRift.rage[i]))
  1899. return;
  1900. }
  1901. console.plog(objWWRift);
  1902. var charmArmed = getPageVariable("user.trinket_name");
  1903. var nBar25 = 0;
  1904. var nBar44 = 0;
  1905. var nBarMinRage = 0;
  1906. var nIndexCharm = -1;
  1907. var nLimit = 0;
  1908. var bResave = false;
  1909. if(objWWRift.factionFocus == 'MBW_40_44'){
  1910. for(i=0;i<objWWRift.rage.length;i++){
  1911. if(objWWRift.rage[i] >= 25)
  1912. nBar25++;
  1913. }
  1914. if(nBar25 >= 3){
  1915. for(i=0;i<objWWRift.rage.length;i++){
  1916. if(objWWRift.rage[i] >= objWWRift.MBW.minRageLLC)
  1917. nBarMinRage++;
  1918. }
  1919. }
  1920. nIndex = nBarMinRage + nBar25;
  1921. checkThenArm(null, 'weapon', objWWRift.MBW.rage4044.weapon[nIndex]);
  1922. checkThenArm(null, 'base', objWWRift.MBW.rage4044.base[nIndex]);
  1923. if(objWWRift.MBW.rage4044.trinket[nIndex].indexOf('FSC') > -1){
  1924. nIndexCharm = objWWRift.funnelCharm.indexOf(charmArmed);
  1925. nLimit = (nIndex >= 3) ? objWWRift.MBW.minRageLLC : 25;
  1926. if(nIndexCharm > -1){
  1927. if(objWWRift.rage[nIndexCharm] >= nLimit){
  1928. temp = minIndex(objWWRift.rage);
  1929. if(temp > -1)
  1930. objWWRift.MBW.rage4044.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1931. }
  1932. else
  1933. objWWRift.MBW.rage4044.trinket[nIndex] = charmArmed;
  1934. }
  1935. else{
  1936. temp = minIndex(objWWRift.rage);
  1937. if(temp > -1)
  1938. objWWRift.MBW.rage4044.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1939. }
  1940. }
  1941. checkThenArm(null, 'trinket', objWWRift.MBW.rage4044.trinket[nIndex]);
  1942. checkThenArm(null, 'bait', objWWRift.MBW.rage4044.bait[nIndex]);
  1943. }
  1944. else if(objWWRift.factionFocus == 'MBW_45_48'){
  1945. for(i=0;i<objWWRift.rage.length;i++){
  1946. if(objWWRift.rage[i] >= 25)
  1947. nBar25++;
  1948. }
  1949. if(nBar25 >= 3){
  1950. for(i=0;i<objWWRift.rage.length;i++){
  1951. if(objWWRift.rage[i] >= 44)
  1952. nBar44++;
  1953. }
  1954. }
  1955. if(nBar44 >= 3){
  1956. for(i=0;i<objWWRift.rage.length;i++){
  1957. if(objWWRift.rage[i] >= objWWRift.MBW.minRageLLC)
  1958. nBarMinRage++;
  1959. }
  1960. }
  1961. nIndex = nBar25 + nBar44 + nBarMinRage;
  1962. checkThenArm(null, 'weapon', objWWRift.MBW.rage4548.weapon[nIndex]);
  1963. checkThenArm(null, 'base', objWWRift.MBW.rage4548.base[nIndex]);
  1964. if(objWWRift.MBW.rage4548.trinket[nIndex].indexOf('FSC') > -1){
  1965. nIndexCharm = objWWRift.funnelCharm.indexOf(charmArmed);
  1966. nLimit = (nIndex >= 3) ? 44 : 25;
  1967. if(nIndexCharm > -1){
  1968. if(objWWRift.rage[nIndexCharm] >= nLimit){
  1969. temp = minIndex(objWWRift.rage);
  1970. if(temp > -1)
  1971. objWWRift.MBW.rage4548.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1972. }
  1973. else
  1974. objWWRift.MBW.rage4548.trinket[nIndex] = charmArmed;
  1975. }
  1976. else{
  1977. temp = minIndex(objWWRift.rage);
  1978. if(temp > -1)
  1979. objWWRift.MBW.rage4548.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1980. }
  1981. }
  1982. checkThenArm(null, 'trinket', objWWRift.MBW.rage4548.trinket[nIndex]);
  1983. checkThenArm(null, 'bait', objWWRift.MBW.rage4548.bait[nIndex]);
  1984. }
  1985. else{
  1986. temp = objWWRift.order.indexOf(objWWRift.factionFocus);
  1987. if(temp == -1)
  1988. return;
  1989. nIndex = Math.floor(objWWRift.rage[temp]/25);
  1990. checkThenArm(null, 'weapon', objWWRift.faction.weapon[nIndex]);
  1991. checkThenArm(null, 'base', objWWRift.faction.base[nIndex]);
  1992. if(objWWRift.faction.trinket[nIndex].indexOf('FSC') > -1){
  1993. if(objWWRift.factionFocusNext == "Remain" || objWWRift.factionFocus == objWWRift.factionFocusNext)
  1994. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1995. else{
  1996. var nLastRage = getStorageToVariableInt("LastRage", 0);
  1997. if(objWWRift.rage[temp] < nLastRage){
  1998. tempNext = objWWRift.order.indexOf(objWWRift.factionFocusNext);
  1999. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[tempNext];
  2000. objWWRift.factionFocus = objWWRift.factionFocusNext;
  2001. bResave = true;
  2002. }
  2003. else
  2004. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[temp];
  2005. }
  2006. }
  2007. checkThenArm(null, 'trinket', objWWRift.faction.trinket[nIndex]);
  2008. checkThenArm(null, 'bait', objWWRift.faction.bait[nIndex]);
  2009. if(bResave){
  2010. // resave into localStorage
  2011. var obj = getStorageToObject('WWRift', objDefaultWWRift);
  2012. obj.factionFocus = objWWRift.factionFocus;
  2013. setStorage('WWRift', JSON.stringify(obj));
  2014. }
  2015. setStorage("LastRage", objWWRift.rage[temp]);
  2016. }
  2017. }
  2018.  
  2019. function iceberg(){
  2020. var loc = GetCurrentLocation();
  2021. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  2022. var objDefaultIceberg = {
  2023. base : new Array(9).fill(''),
  2024. trinket : new Array(9).fill('None'),
  2025. bait : new Array(9).fill('Gouda')
  2026. };
  2027. var objIceberg = getStorageToObject('Iceberg', objDefaultIceberg);
  2028. var nIndex = -1;
  2029. if (loc.indexOf('Iceberg') > -1) {
  2030. var phase;
  2031. var nProgress = -1;
  2032. var classCurrentPhase = document.getElementsByClassName('currentPhase');
  2033. if(classCurrentPhase.length > 0)
  2034. phase = classCurrentPhase[0].textContent;
  2035. else
  2036. phase = getPageVariable('user.quests.QuestIceberg.current_phase');
  2037. var classProgress = document.getElementsByClassName('user_progress');
  2038. if(classProgress.length > 0)
  2039. nProgress = parseInt(classProgress[0].textContent.replace(',', ''));
  2040. else
  2041. nProgress = parseInt(getPageVariable('user.quests.QuestIceberg.user_progress'));
  2042. console.plog('In', phase, 'at', nProgress, 'feets');
  2043.  
  2044. if (nProgress == 300 || nProgress == 600 || nProgress == 1600 || nProgress == 1800)
  2045. nIndex = 0;
  2046. else{
  2047. phase = phase.toUpperCase();
  2048. for(var i=1;i<arrOrder.length;i++){
  2049. if(phase.indexOf(arrOrder[i]) > -1){
  2050. nIndex = i;
  2051. break;
  2052. }
  2053. }
  2054. }
  2055. }
  2056. else if (loc.indexOf('Slushy Shoreline') > -1)
  2057. nIndex = arrOrder.indexOf('SLUSHY');
  2058. if(nIndex < 0)
  2059. return;
  2060. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2061. checkThenArm(null, 'base', objIceberg.base[nIndex]);
  2062. checkThenArm(null, 'trinket', objIceberg.trinket[nIndex]);
  2063. checkThenArm(null, 'bait', objIceberg.bait[nIndex]);
  2064. }
  2065.  
  2066. function BurroughRift(bCheckLoc, minMist, maxMist, nToggle)
  2067. {
  2068. //Tier 0: 0 Mist Canisters
  2069. //Tier 1/Yellow: 1-5 Mist Canisters
  2070. //Tier 2/Green: 6-18 Mist Canisters
  2071. //Tier 3/Red: 19-20 Mist Canisters
  2072. if (bCheckLoc && GetCurrentLocation().indexOf('Burroughs Rift') < 0)
  2073. return;
  2074.  
  2075. var currentMistQuantity = parseInt(document.getElementsByClassName('mistQuantity')[0].innerText);
  2076. var isMisting = (getPageVariable('user.quests.QuestRiftBurroughs.is_misting') == 'true');
  2077. var mistButton = document.getElementsByClassName('mistButton')[0];
  2078. console.plog('Current Mist Quantity:', currentMistQuantity, 'Is Misting:', isMisting);
  2079. if(minMist === 0 && maxMist === 0){
  2080. if(isMisting){
  2081. console.plog('Stop mist...');
  2082. fireEvent(mistButton, 'click');
  2083. }
  2084. }
  2085. else if(currentMistQuantity >= maxMist && isMisting)
  2086. {
  2087. if(maxMist == 20 && Number.isInteger(nToggle)){
  2088. if(nToggle == 1){
  2089. console.plog('Stop mist...');
  2090. fireEvent(mistButton, 'click');
  2091. }
  2092. else{
  2093. var nCount20 = getStorageToVariableInt('BR20_Count', 0);
  2094. nCount20++;
  2095. if(nCount20 >= nToggle){
  2096. nCount20 = 0;
  2097. console.plog('Stop mist...');
  2098. fireEvent(mistButton, 'click');
  2099. }
  2100. setStorage('BR20_Count', nCount20);
  2101. }
  2102. }
  2103. else{
  2104. console.plog('Stop mist...');
  2105. fireEvent(mistButton, 'click');
  2106. }
  2107. }
  2108. else if(currentMistQuantity <= minMist && !isMisting)
  2109. {
  2110. console.plog('Start mist...');
  2111. fireEvent(mistButton, 'click');
  2112. }
  2113. return currentMistQuantity;
  2114. }
  2115.  
  2116. function BRCustom(){
  2117. if (GetCurrentLocation().indexOf('Burroughs Rift') < 0)
  2118. return;
  2119.  
  2120. var objDefaultBRCustom = {
  2121. hunt : '',
  2122. toggle : 1,
  2123. name : ['Red', 'Green', 'Yellow', 'None'],
  2124. weapon : new Array(4),
  2125. base : new Array(4),
  2126. trinket : new Array(4),
  2127. bait : new Array(4)
  2128. };
  2129. var objBR = getStorageToObject('BRCustom', objDefaultBRCustom);
  2130. var mistQuantity = 0;
  2131. if(objBR.hunt == 'Red')
  2132. mistQuantity = BurroughRift(false, 19, 20, objBR.toggle);
  2133. else if(objBR.hunt == 'Green')
  2134. mistQuantity = BurroughRift(false, 6, 18);
  2135. else if(objBR.hunt == 'Yellow')
  2136. mistQuantity = BurroughRift(false, 1, 5);
  2137. else
  2138. mistQuantity = BurroughRift(false, 0, 0);
  2139.  
  2140. var currentTier = '';
  2141. if(mistQuantity >= 19)
  2142. currentTier = 'Red';
  2143. else if(mistQuantity >= 6)
  2144. currentTier = 'Green';
  2145. else if(mistQuantity >= 1)
  2146. currentTier = 'Yellow';
  2147. else
  2148. currentTier = 'None';
  2149.  
  2150. if(currentTier != objBR.hunt)
  2151. return;
  2152.  
  2153. var nIndex = objBR.name.indexOf(currentTier);
  2154. checkThenArm(null, 'weapon', objBR.weapon[nIndex]);
  2155. checkThenArm(null, 'base', objBR.base[nIndex]);
  2156. checkThenArm(null, 'bait', objBR.bait[nIndex]);
  2157. if(objBR.trinket[nIndex] == 'None')
  2158. disarmTrap('trinket');
  2159. else
  2160. checkThenArm(null, 'trinket', objBR.trinket[nIndex]);
  2161. }
  2162.  
  2163. function LGGeneral(objLG) {
  2164. var loc = GetCurrentLocation();
  2165. switch (loc)
  2166. {
  2167. case 'Living Garden':
  2168. livingGarden(objLG); break;
  2169. case 'Lost City':
  2170. lostCity(objLG); break;
  2171. case 'Sand Dunes':
  2172. sandDunes(); break;
  2173. case 'Twisted Garden':
  2174. twistedGarden(objLG); break;
  2175. case 'Cursed City':
  2176. cursedCity(objLG); break;
  2177. case 'Sand Crypts':
  2178. sandCrypts(objLG); break;
  2179. default:
  2180. return;
  2181. }
  2182. DisarmLGSpecialCharm(loc);
  2183. }
  2184.  
  2185. function seasonalGarden(){
  2186. if(GetCurrentLocation().indexOf('Seasonal Garden') < 0)
  2187. return;
  2188.  
  2189. var cheeseArmed = getPageVariable('user.bait_name');
  2190. if(cheeseArmed.indexOf('Checkmate') > -1)
  2191. checkThenArm(null, 'bait', 'Gouda');
  2192.  
  2193. var objDefaultSG = {
  2194. weapon : new Array(4).fill(''),
  2195. base : new Array(4).fill(''),
  2196. trinket : new Array(4).fill(''),
  2197. bait : new Array(4).fill(''),
  2198. disarmBaitAfterCharged : false
  2199. };
  2200. var objSG = getStorageToObject('SGarden', objDefaultSG);
  2201. objSG.season = ['Spring', 'Summer', 'Fall', 'Winter'];
  2202. var now = (g_nTimeOffset === 0) ? new Date() : new Date(Date.now() + g_nTimeOffset*1000);
  2203. var nTimeStamp = Date.parse(now)/1000;
  2204. var nFirstSeasonTimeStamp = 1283328000;
  2205. var nSeasonLength = 288000; // 80hr
  2206. var nSeason = Math.floor((nTimeStamp - nFirstSeasonTimeStamp)/nSeasonLength) % objSG.season.length;
  2207. var nSeasonNext = nSeasonLength - ((nTimeStamp - nFirstSeasonTimeStamp) % nSeasonLength);
  2208. var nCurrentAmp = parseInt(getPageVariable("user.viewing_atts.zzt_amplifier"));
  2209. var nMaxAmp = parseInt(getPageVariable("user.viewing_atts.zzt_max_amplifier"));
  2210. console.plog('Current Amplifier:', nCurrentAmp, 'Current Season:', objSG.season[nSeason], 'Next Season In:', timeFormat(nSeasonNext));
  2211. if(nSeasonNext <= nextActiveTime){ // total seconds left to next season less than next active time
  2212. nSeason++;
  2213. if(nSeason >= objSG.season.length)
  2214. nSeason = 0;
  2215. }
  2216.  
  2217. checkThenArm(null, 'weapon', objSG.weapon[nSeason]);
  2218. checkThenArm(null, 'base', objSG.base[nSeason]);
  2219. checkThenArm(null, 'trinket', objSG.trinket[nSeason]);
  2220. if(nCurrentAmp+1 >= nMaxAmp){
  2221. if(getPageVariable('user.trinket_name').indexOf('Amplifier') > -1)
  2222. disarmTrap('trinket');
  2223. if(nCurrentAmp >= nMaxAmp && objSG.disarmBaitAfterCharged)
  2224. disarmTrap('bait');
  2225. else
  2226. checkThenArm(null, 'bait', objSG.bait[nSeason]);
  2227. }
  2228. else
  2229. checkThenArm(null, 'bait', objSG.bait[nSeason]);
  2230. }
  2231.  
  2232. function zugzwangTower(){
  2233. var loc = GetCurrentLocation();
  2234. if (loc.indexOf("Seasonal Garden") > -1){
  2235. setStorage('eventLocation', 'SG');
  2236. seasonalGarden();
  2237. return;
  2238. }
  2239. else if (loc.indexOf("Zugzwang's Tower") < 0)
  2240. return;
  2241.  
  2242. var objDefaultZT = {
  2243. focus : 'MYSTIC',
  2244. order : ['PAWN', 'KNIGHT', 'BISHOP', 'ROOK', 'QUEEN', 'KING', 'CHESSMASTER'],
  2245. weapon : new Array(14).fill(''),
  2246. base : new Array(14).fill(''),
  2247. trinket : new Array(14).fill('None'),
  2248. bait : new Array(14).fill('Gouda'),
  2249. };
  2250. var objZT = getStorageToObject('ZTower', objDefaultZT);
  2251. objZT.focus = objZT.focus.toUpperCase();
  2252. var nProgressMystic = parseInt(getPageVariable('user.viewing_atts.zzt_mage_progress'));
  2253. var nProgressTechnic = parseInt(getPageVariable('user.viewing_atts.zzt_tech_progress'));
  2254. if(Number.isNaN(nProgressMystic) || Number.isNaN(nProgressTechnic))
  2255. return;
  2256.  
  2257. var strUnlockMystic = getZTUnlockedMouse(nProgressMystic);
  2258. var strUnlockTechnic = getZTUnlockedMouse(nProgressTechnic);
  2259. if(strUnlockMystic === "" || strUnlockTechnic === "")
  2260. return;
  2261. var nIndex = -1;
  2262. console.plog(capitalizeFirstLetter(objZT.focus),'Progress Mystic:',nProgressMystic,'Unlock Mystic:',strUnlockMystic,'Progress Technic:',nProgressTechnic,'Unlock Technic:',strUnlockTechnic);
  2263. if(objZT.focus.indexOf('MYSTIC') === 0){ // Mystic side first
  2264. if(strUnlockMystic == 'CHESSMASTER' && objZT.focus.indexOf('=>') > -1){ // is double run?
  2265. nIndex = objZT.order.indexOf(strUnlockTechnic);
  2266. if(nIndex > -1)
  2267. nIndex += 7;
  2268. }
  2269. else{ // single run
  2270. nIndex = objZT.order.indexOf(strUnlockMystic);
  2271. }
  2272. }
  2273. else{ // Technic side first
  2274. if(strUnlockTechnic == 'CHESSMASTER' && objZT.focus.indexOf('=>') > -1){ // is double run?
  2275. nIndex = objZT.order.indexOf(strUnlockMystic);
  2276. if(nIndex > -1)
  2277. nIndex += 7;
  2278. }
  2279. else{ // single run
  2280. nIndex = objZT.order.indexOf(strUnlockTechnic);
  2281. }
  2282. }
  2283.  
  2284. if(nIndex == -1)
  2285. return;
  2286.  
  2287. if(objZT.weapon[nIndex] == 'MPP/TPP'){
  2288. if(objZT.focus.indexOf('MYSTIC') === 0)
  2289. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Technic Pawn Pincher' : 'Mystic Pawn Pincher';
  2290. else
  2291. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Mystic Pawn Pincher' : 'Technic Pawn Pincher';
  2292. }
  2293. else if(objZT.weapon[nIndex] == 'BPT/OAT'){
  2294. if(objZT.focus.indexOf('MYSTIC') === 0)
  2295. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Obvious Ambush Trap' : 'Blackstone Pass Trap';
  2296. else
  2297. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Blackstone Pass Trap' : 'Obvious Ambush Trap';
  2298. }
  2299.  
  2300. for (var prop in objZT) {
  2301. if(objZT.hasOwnProperty(prop) &&
  2302. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')) {
  2303. if(objZT[prop][nIndex] == 'None')
  2304. disarmTrap(prop);
  2305. else
  2306. checkThenArm(null, prop, objZT[prop][nIndex]);
  2307. }
  2308. }
  2309. }
  2310.  
  2311. function getZTUnlockedMouse(nProgress){
  2312. var strUnlock = "";
  2313. if(nProgress <= 7)
  2314. strUnlock = 'PAWN';
  2315. else if(nProgress <= 9)
  2316. strUnlock = 'KNIGHT';
  2317. else if(nProgress <= 11)
  2318. strUnlock = 'BISHOP';
  2319. else if(nProgress <= 13)
  2320. strUnlock = 'ROOK';
  2321. else if(nProgress <= 14)
  2322. strUnlock = 'QUEEN';
  2323. else if(nProgress <= 15)
  2324. strUnlock = 'KING';
  2325. else if(nProgress <= 16)
  2326. strUnlock = 'CHESSMASTER';
  2327. return strUnlock;
  2328. }
  2329.  
  2330. function balackCoveJOD(){
  2331. var curLoc = GetCurrentLocation();
  2332. var bInJOD = (curLoc.indexOf('Jungle') > -1);
  2333. var bInBC = (curLoc.indexOf('Balack') > -1);
  2334. if(!(bInJOD || bInBC))
  2335. return;
  2336. var objDefaultBCJOD = {
  2337. order : ['JOD','LOW','MID','HIGH'],
  2338. weapon : new Array(4).fill(''),
  2339. base : new Array(4).fill(''),
  2340. trinket : new Array(4).fill(''),
  2341. bait : new Array(4).fill('')
  2342. };
  2343. var objBCJOD = getStorageToObject('BC_JOD', objDefaultBCJOD);
  2344. var nIndex = -1;
  2345. if(bInJOD)
  2346. nIndex = 0;
  2347. else{
  2348. var i = 0;
  2349. var objBC = {
  2350. arrTide : ['Low Rising', 'Mid Rising', 'High Rising', 'High Ebbing', 'Mid Ebbing', 'Low Ebbing'],
  2351. arrLength : [24, 3, 1, 1, 3, 24],
  2352. arrAll : []
  2353. };
  2354. var nTimeStamp = Math.floor(Date.now()/1000) + g_nTimeOffset*1000;
  2355. var nFirstTideTimeStamp = 1294708860;
  2356. var nTideLength = 1200; // 20min
  2357. for(i=0;i<objBC.arrTide.length;i++){
  2358. objBC.arrAll = objBC.arrAll.concat(new Array(objBC.arrLength[i]).fill(objBC.arrTide[i]));
  2359. }
  2360. var nTideTotalLength = sumData(objBC.arrLength);
  2361. var nDiff = nTimeStamp - nFirstTideTimeStamp;
  2362. var nIndexCurrentTide = Math.floor(nDiff/nTideLength) % nTideTotalLength;
  2363. var tideNameCurrent = objBC.arrAll[nIndexCurrentTide];
  2364. var tideNameNext;
  2365. if(tideNameCurrent.indexOf('Low') > -1)
  2366. tideNameNext = 'Mid Rising';
  2367. else if(tideNameCurrent.indexOf('High') > -1)
  2368. tideNameNext = 'Mid Ebbing';
  2369. else if(tideNameCurrent == 'Mid Rising')
  2370. tideNameNext = 'High Rising';
  2371. else if(tideNameCurrent == 'Mid Ebbing')
  2372. tideNameNext = 'Low Ebbing';
  2373.  
  2374. var nTideDist = objBC.arrAll.indexOf(tideNameNext) + nTideTotalLength - nIndexCurrentTide;
  2375. nTideDist = nTideDist % nTideTotalLength;
  2376. var nNextTideTime = nTideDist*nTideLength - nDiff%nTideLength;
  2377. var strTempCurrent = tideNameCurrent.toUpperCase().split(' ')[0];
  2378. var strTempNext = tideNameNext.toUpperCase().split(' ')[0];
  2379. nIndex = objBCJOD.order.indexOf(strTempCurrent);
  2380. if(nNextTideTime <= nextActiveTime && strTempNext != strTempCurrent) // total seconds left to next tide less than next active time
  2381. nIndex = objBCJOD.order.indexOf(strTempNext);
  2382. console.plog('Current Tide:', objBC.arrAll[nIndexCurrentTide], 'Index:', nIndex, 'Next Tide:', tideNameNext, 'In', timeFormat(nNextTideTime));
  2383. if(nIndex < 0)
  2384. return;
  2385. }
  2386. checkThenArm(null, 'weapon', objBCJOD.weapon[nIndex]);
  2387. checkThenArm(null, 'base', objBCJOD.base[nIndex]);
  2388. checkThenArm(null, 'trinket', objBCJOD.trinket[nIndex]);
  2389. checkThenArm(null, 'bait', objBCJOD.bait[nIndex]);
  2390. }
  2391.  
  2392. function forbiddenGroveAR(){
  2393. var curLoc = GetCurrentLocation();
  2394. var bInFG = (curLoc.indexOf('Forbidden Grove') > -1);
  2395. var bInAR = (curLoc.indexOf('Acolyte Realm') > -1);
  2396. if(!(bInFG || bInAR))
  2397. return;
  2398. var objDefaultFGAR = {
  2399. order : ['FG','AR'],
  2400. weapon : new Array(2).fill(''),
  2401. base : new Array(2).fill(''),
  2402. trinket : new Array(2).fill(''),
  2403. bait : new Array(2).fill('')
  2404. };
  2405. var objFGAR = getStorageToObject('FG_AR', objDefaultFGAR);
  2406. var nIndex = (bInFG) ? 0 : 1;
  2407. checkThenArm(null, 'weapon', objFGAR.weapon[nIndex]);
  2408. checkThenArm(null, 'base', objFGAR.base[nIndex]);
  2409. checkThenArm(null, 'trinket', objFGAR.trinket[nIndex]);
  2410. checkThenArm(null, 'bait', objFGAR.bait[nIndex]);
  2411. }
  2412.  
  2413. function SunkenCity(isAggro) {
  2414. if (GetCurrentLocation().indexOf("Sunken City") < 0)
  2415. return;
  2416.  
  2417. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  2418. console.plog('Current Zone:', zone);
  2419. var currentZone = GetSunkenCityZone(zone);
  2420. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2421. if (currentZone == objSCZone.ZONE_NOT_DIVE){
  2422. checkThenArm('best', 'base', objBestTrap.base.luck);
  2423. checkThenArm(null, 'trinket', 'Oxygen Burst');
  2424. checkThenArm('best', 'bait', ['Fishy Fromage', 'Gouda']);
  2425. return;
  2426. }
  2427.  
  2428. checkThenArm('best', 'base', bestSCBase);
  2429. var distance = parseInt(getPageVariable('user.quests.QuestSunkenCity.distance'));
  2430. console.plog('Dive Distance(m):', distance);
  2431. var charmArmed = getPageVariable("user.trinket_name");
  2432. var charmElement = document.getElementsByClassName('charm');
  2433. var isEACArmed = (charmArmed.indexOf('Empowered Anchor') > -1);
  2434. var isWJCArmed = (charmArmed.indexOf('Water Jet') > -1);
  2435. if (currentZone == objSCZone.ZONE_OXYGEN || currentZone == objSCZone.ZONE_TREASURE || currentZone == objSCZone.ZONE_BONUS){
  2436. if (isAggro && (currentZone == objSCZone.ZONE_TREASURE))
  2437. checkThenArm('best', 'trinket', ['Golden Anchor', 'Empowered Anchor']);
  2438. else{
  2439. // arm Empowered Anchor Charm
  2440. if (!isEACArmed){
  2441. if (parseInt(charmElement[0].innerText) > 0)
  2442. fireEvent(charmElement[0], 'click');
  2443. }
  2444. }
  2445.  
  2446. checkThenArm(null, 'bait', 'SUPER');
  2447. }
  2448. else if (currentZone == objSCZone.ZONE_DANGER_PP || currentZone == objSCZone.ZONE_DANGER_PP_LOTA){
  2449. if (!isAggro){
  2450. // arm Empowered Anchor Charm
  2451. if (!isEACArmed && !isAggro){
  2452. if (parseInt(charmElement[0].innerText) > 0)
  2453. fireEvent(charmElement[0], 'click');
  2454. }
  2455. }
  2456. else
  2457. checkThenArm('best', 'trinket', ['Spiked Anchor', 'Empowered Anchor']);
  2458. checkThenArm(null, 'bait', 'Gouda');
  2459. }
  2460. else if ((currentZone == objSCZone.ZONE_DEFAULT) && isAggro){
  2461. var depth = parseInt(getPageVariable('user.quests.QuestSunkenCity.zones[1].length'));
  2462. if (depth >= 500){
  2463. var nextZoneName = getPageVariable('user.quests.QuestSunkenCity.zones[2].name');
  2464. var nextZoneLeft = parseInt(getPageVariable('user.quests.QuestSunkenCity.zones[2].left'));
  2465. var nextZone = GetSunkenCityZone(nextZoneName);
  2466. var distanceToNextZone = parseInt((nextZoneLeft - 80) / 0.6);
  2467. console.plog('Distance to next zone(m):', distanceToNextZone);
  2468. if (distanceToNextZone >= 480 || (distanceToNextZone >= 230 && nextZone == objSCZone.ZONE_DEFAULT)){
  2469. // arm Water Jet Charm
  2470. checkThenArm('best', 'trinket', ['Smart Water Jet', 'Water Jet']);
  2471. }
  2472. else
  2473. DisarmSCSpecialCharm(charmArmed);
  2474. }
  2475. else
  2476. DisarmSCSpecialCharm(charmArmed);
  2477.  
  2478. checkThenArm(null, 'bait', 'Gouda');
  2479. }
  2480. else{
  2481. DisarmSCSpecialCharm(charmArmed);
  2482. checkThenArm(null, 'bait', 'Gouda');
  2483. }
  2484. }
  2485.  
  2486. function gwh(){
  2487. if (GetCurrentLocation().indexOf("Great Winter Hunt") < 0)
  2488. return;
  2489.  
  2490. var userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestWinterHunt2016)'));
  2491. var objDefaultGWH2016 = {
  2492. zone : ['ORDER1','ORDER2','NONORDER1','NONORDER2','WINTER_WASTELAND','SNOWBALL_STORM','FLYING','NEW_YEAR\'S_PARTY'],
  2493. weapon : new Array(8).fill(''),
  2494. base : new Array(8).fill(''),
  2495. trinket : new Array(8).fill(''),
  2496. bait : new Array(8).fill(''),
  2497. boost : new Array(8).fill(false),
  2498. turbo : false,
  2499. minAAToFly : 20,
  2500. minFireworkToFly : 20,
  2501. landAfterFireworkRunOut : false
  2502. };
  2503. var objGWH = getStorageToObject('GWH2016R', objDefaultGWH2016);
  2504. var i,j,nLimit,strTemp,nIndex,nIndexTemp;
  2505. var bCanFly = false;
  2506. var nAAQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-featuredItem-quantity')[0].textContent);
  2507. var nFireworkQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-fireworks-quantity')[0].textContent);
  2508. if(userVariable.order_progress >= 10){ // can fly
  2509. bCanFly = true;
  2510. console.plog('Order Progress:', userVariable.order_progress, 'AA Quantity:', nAAQuantity, 'Firework Quantity:', nFireworkQuantity);
  2511. if(nAAQuantity >= objGWH.minAAToFly && nFireworkQuantity >= objGWH.minFireworkToFly){
  2512. fireEvent(document.getElementsByClassName('winterHunt2016HUD-flightButton')[0], 'click');
  2513. userVariable.status = 'flying';
  2514. }
  2515. }
  2516. if(userVariable.status == 'flying'){
  2517. if(nFireworkQuantity < 1 && objGWH.landAfterFireworkRunOut === true){
  2518. console.plog('Landing');
  2519. fireEvent(document.getElementsByClassName('winterHunt2016HUD-landButton mousehuntTooltipParent mousehuntActionButton tiny')[0], 'click');
  2520. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small winterHunt2016HUD-help-action-land active')[0], 'click'); }, 1500);
  2521. window.setTimeout(function () { eventLocationCheck('gwh'); }, 5000);
  2522. return;
  2523. }
  2524. console.plog('Flying');
  2525. nIndex = objGWH.zone.indexOf('FLYING');
  2526. checkThenArm(null, 'weapon', objGWH.weapon[nIndex]);
  2527. checkThenArm(null, 'base', objGWH.base[nIndex]);
  2528. checkThenArm(null, 'trinket', objGWH.trinket[nIndex]);
  2529. if(objGWH.bait[nIndex].indexOf('ANY') > -1 && nAAQuantity > 0)
  2530. checkThenArm(null, 'bait', 'Arctic Asiago');
  2531. else
  2532. checkThenArm(null, 'bait', objGWH.bait[nIndex]);
  2533. if(objGWH.boost[nIndex] === true){
  2534. var nNitroQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-sledDetail')[2].textContent);
  2535. console.plog('Nitro Quantity:', nNitroQuantity);
  2536. if(Number.isNaN(nNitroQuantity) || nNitroQuantity < 1)
  2537. return;
  2538. if(objGWH.turbo && nNitroQuantity >= 3)
  2539. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[3], 'click');
  2540. else
  2541. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2542. }
  2543. else{
  2544. if(userVariable.speed > 800){ // disable nitro when flying
  2545. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2546. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2547. }
  2548. }
  2549. return;
  2550. }
  2551. var objOrderTemplate = {
  2552. type : "none",
  2553. tier : 1,
  2554. progress : 0
  2555. };
  2556. var arrOrder = [];
  2557. var arrType = ["decoration", "ski", "toy"];
  2558. for(i=0;i<userVariable.orders.length;i++){
  2559. arrOrder.push(JSON.parse(JSON.stringify(objOrderTemplate)));
  2560. for(j=0;j<arrType.length;j++){
  2561. if(userVariable.orders[i].item_type.indexOf(arrType[j]) > -1){
  2562. arrOrder[i].type = arrType[j];
  2563. break;
  2564. }
  2565. }
  2566. if(userVariable.orders[i].item_type.indexOf("_one_") > -1)
  2567. arrOrder[i].tier = 1;
  2568. else
  2569. arrOrder[i].tier = 2;
  2570. arrOrder[i].progress = userVariable.orders[i].progress;
  2571. if(arrOrder[i].progress >= 100 && !bCanFly){
  2572. console.plog('Order No:',i,'Type:',arrOrder[i].type,'Tier:',arrOrder[i].tier,'Progress:',arrOrder[i].progress);
  2573. fireEvent(document.getElementsByClassName('winterHunt2016HUD-order-action')[i],'click');
  2574. window.setTimeout(function () { eventLocationCheck('gwh'); }, 5000);
  2575. return;
  2576. }
  2577. }
  2578. console.plog(arrOrder);
  2579.  
  2580. var objZoneTemplate = {
  2581. name : "",
  2582. depth : 0,
  2583. isOrderZone : false,
  2584. type : "none",
  2585. tier : 1,
  2586. codename : ""
  2587. };
  2588. var arrZone = [];
  2589. var nIndexActive = -1;
  2590. for(i=userVariable.sprites.length-1;i>=0;i--){
  2591. if(userVariable.sprites[i].css_class.indexOf('active') > -1){ // current zone
  2592. nIndexActive = i;
  2593. break;
  2594. }
  2595. }
  2596. if(nIndexActive < 0)
  2597. return;
  2598. nLimit = nIndexActive + 2;
  2599. if(nLimit >= userVariable.sprites.length)
  2600. nLimit = userVariable.sprites.length - 1;
  2601. for(i=nIndexActive;i<=nLimit;i++){
  2602. nIndex = i - nIndexActive;
  2603. arrZone.push(JSON.parse(JSON.stringify(objZoneTemplate)));
  2604. nIndexTemp = userVariable.sprites[i].name.indexOf("(");
  2605. arrZone[nIndex].name = userVariable.sprites[i].name.substr(0,nIndexTemp-1);
  2606. if(arrZone[nIndex].name == 'Toy Lot' || arrZone[nIndex].name == 'Toy Emporium')
  2607. arrZone[nIndex].type = "toy";
  2608. else if(arrZone[nIndex].name == 'Decorative Oasis' || arrZone[nIndex].name == 'Tinsel Forest')
  2609. arrZone[nIndex].type = "decoration";
  2610. else if(arrZone[nIndex].name == 'Bunny Hills' || arrZone[nIndex].name == 'Frosty Mountains')
  2611. arrZone[nIndex].type = "ski";
  2612. arrZone[nIndex].tier = (userVariable.sprites[i].css_class.indexOf('tier_two') > -1) ? 2 : 1;
  2613. for(j=0;j<arrOrder.length;j++){
  2614. if(arrOrder[j].type == arrZone[nIndex].type && arrOrder[j].tier <= arrZone[nIndex].tier){
  2615. arrZone[nIndex].isOrderZone = true;
  2616. break;
  2617. }
  2618. }
  2619. if(arrZone[nIndex].type == "none"){
  2620. arrZone[nIndex].codename = arrZone[nIndex].name.toUpperCase().replace(/ /g,'_');
  2621. }
  2622. else{
  2623. if(arrZone[nIndex].isOrderZone)
  2624. arrZone[nIndex].codename = "ORDER" + arrZone[nIndex].tier;
  2625. else
  2626. arrZone[nIndex].codename = "NONORDER" + arrZone[nIndex].tier;
  2627. }
  2628. arrZone[nIndex].depth = parseInt(userVariable.sprites[i].name.substr(nIndexTemp+1,5));
  2629. }
  2630. console.plog(arrZone);
  2631.  
  2632. var nIndexZone = objGWH.zone.indexOf(arrZone[0].codename);
  2633. if(nIndexZone < 0)
  2634. return;
  2635. checkThenArm(null, 'weapon', objGWH.weapon[nIndexZone]);
  2636. checkThenArm(null, 'base', objGWH.base[nIndexZone]);
  2637. checkThenArm(null, 'trinket', objGWH.trinket[nIndexZone]);
  2638. if(objGWH.bait[nIndexZone].indexOf('ANY') > -1 && nAAQuantity > 0)
  2639. checkThenArm(null, 'bait', 'Arctic Asiago');
  2640. else
  2641. checkThenArm(null, 'bait', objGWH.bait[nIndexZone]);
  2642. if(objGWH.boost[nIndexZone] === true){
  2643. var nNitroQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-sledDetail')[2].textContent);
  2644. console.plog('Nitro Quantity:', nNitroQuantity);
  2645. if(Number.isNaN(nNitroQuantity) || nNitroQuantity < 1)
  2646. return;
  2647. var nTotalMetersRemaining = parseInt(userVariable.meters_remaining);
  2648. for(i=1;i<arrZone.length;i++){
  2649. nIndexZone = objGWH.zone.indexOf(arrZone[i].codename);
  2650. if(nIndexZone < 0)
  2651. continue;
  2652. if(objGWH.boost[nIndexZone] === true)
  2653. nTotalMetersRemaining += arrZone[i].depth;
  2654. else
  2655. break;
  2656. }
  2657. console.plog('Boost Distance:', nTotalMetersRemaining, 'Turbo:', objGWH.turbo);
  2658. var fTemp = nTotalMetersRemaining/250;
  2659. var nLevel = Math.floor(fTemp);
  2660. if((nLevel - fTemp) >= 0.92) // because 230/250 = 0.92
  2661. nLevel++;
  2662. if(nLevel == 1){ // normal boost
  2663. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2664. }
  2665. else if(nLevel > 1){
  2666. if(objGWH.turbo && nNitroQuantity >= 3)
  2667. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[3], 'click');
  2668. else
  2669. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2670. }
  2671. else if(nLevel < 1 && userVariable.speed > 30){
  2672. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2673. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2674. }
  2675. }
  2676. else{
  2677. if(userVariable.speed > 30){ // disable nitro in order zone
  2678. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2679. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2680. }
  2681. }
  2682. }
  2683.  
  2684. function SCCustom() {
  2685. if (GetCurrentLocation().indexOf("Sunken City") < 0)
  2686. return;
  2687.  
  2688. var objDefaultSCCustom = {
  2689. 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'],
  2690. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  2691. isHunt : new Array(11).fill(true),
  2692. bait : new Array(11).fill('Gouda'),
  2693. trinket : new Array(11).fill('None'),
  2694. useSmartJet : false
  2695. };
  2696. var objSCCustom = getStorageToObject('SCCustom', objDefaultSCCustom);
  2697. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  2698. var zoneID = GetSunkenCityZone(zone);
  2699. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2700. if (zoneID == objSCZone.ZONE_NOT_DIVE){
  2701. checkThenArm('best', 'base', objBestTrap.base.luck);
  2702. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2703. checkThenArm(null, 'bait', objSCCustom.bait[zoneID]);
  2704. return;
  2705. }
  2706. var distance = parseInt(getPageVariable('user.quests.QuestSunkenCity.distance'));
  2707. console.plog('Current Zone:', zone, 'ID', zoneID, 'at meter', distance);
  2708. checkThenArm('best', 'base', bestSCBase);
  2709. var canJet = false;
  2710. if (!objSCCustom.isHunt[zoneID]){
  2711. var distanceToNextZone = [];
  2712. var isNextZoneInHuntZone = [];
  2713. var arrZone = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestSunkenCity.zones)'));
  2714. var nActiveZone = parseInt(getPageVariable('user.quests.QuestSunkenCity.active_zone'));
  2715. var nStartZoneIndex = 0;
  2716. var i, nIndex;
  2717. for(i=0;i<arrZone.length;i++){
  2718. if(arrZone[i].num == nActiveZone){
  2719. nStartZoneIndex = i+1;
  2720. break;
  2721. }
  2722. }
  2723. console.plog('Start Zone Index:', nStartZoneIndex);
  2724. for(i=nStartZoneIndex;i<arrZone.length;i++){
  2725. nIndex = i-nStartZoneIndex;
  2726. distanceToNextZone[nIndex] = parseInt((arrZone[i].left - 80) / 0.6);
  2727. isNextZoneInHuntZone[nIndex] = (objSCCustom.isHunt[GetSunkenCityZone(arrZone[i].name)]);
  2728. console.plog('Next Zone:', arrZone[i].name, 'in meter', distanceToNextZone[nIndex], 'Is In Hunt Zone:', isNextZoneInHuntZone[nIndex]);
  2729. }
  2730. if(distanceToNextZone.length === 0){
  2731. distanceToNextZone[0] = 0;
  2732. isNextZoneInHuntZone[0] = true;
  2733. }
  2734.  
  2735. // jet through
  2736. var charmElement = document.getElementsByClassName('charm');
  2737. var charmArmed = getPageVariable("user.trinket_name");
  2738. var isWJCArmed = (charmArmed.indexOf('Water Jet') > -1);
  2739. if (distanceToNextZone[0] >= 480 || (distanceToNextZone[1] >= 480 && (!isNextZoneInHuntZone[0])) || (!(isNextZoneInHuntZone[0]||isNextZoneInHuntZone[1]))) {
  2740. // arm Water Jet Charm
  2741. if(objSCCustom.useSmartJet)
  2742. checkThenArm('best', 'trinket', ['Smart Water Jet', 'Water Jet', objSCCustom.trinket[zoneID]]);
  2743. else
  2744. checkThenArm('best', 'trinket', ['Water Jet', objSCCustom.trinket[zoneID]]);
  2745. }
  2746. else
  2747. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2748. }
  2749. else
  2750. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2751. checkThenArm(null, 'bait', objSCCustom.bait[zoneID]);
  2752. }
  2753.  
  2754. function DisarmSCSpecialCharm(charmArmedName)
  2755. {
  2756. var specialCharms = ['Golden Anchor', 'Spiked Anchor', 'Ultimate Anchor', 'Oxygen Burst', 'Empowered Anchor', 'Water Jet'];
  2757. for (var i = 0; i < specialCharms.length; i++)
  2758. {
  2759. if (charmArmedName.indexOf(specialCharms[i]) > -1)
  2760. {
  2761. disarmTrap('trinket');
  2762. break;
  2763. }
  2764. }
  2765. }
  2766.  
  2767. function GetSunkenCityZone(zoneName)
  2768. {
  2769. var returnZone = 0;
  2770. switch (zoneName){
  2771. case 'Sand Dollar Sea Bar':
  2772. case 'Pearl Patch':
  2773. case 'Sunken Treasure':
  2774. returnZone = objSCZone.ZONE_TREASURE;
  2775. break;
  2776. case 'Feeding Grounds':
  2777. case 'Carnivore Cove':
  2778. returnZone = objSCZone.ZONE_DANGER;
  2779. break;
  2780. case 'Monster Trench':
  2781. returnZone = objSCZone.ZONE_DANGER_PP;
  2782. break;
  2783. case 'Lair of the Ancients':
  2784. returnZone = objSCZone.ZONE_DANGER_PP_LOTA;
  2785. break;
  2786. case 'Deep Oxygen Stream':
  2787. case 'Oxygen Stream':
  2788. returnZone = objSCZone.ZONE_OXYGEN;
  2789. break;
  2790. case 'Magma Flow':
  2791. returnZone = objSCZone.ZONE_BONUS;
  2792. break;
  2793. case 'Coral Reef':
  2794. case 'Coral Garden':
  2795. case 'Coral Castle':
  2796. returnZone = objSCZone.ZONE_CORAL;
  2797. break;
  2798. case 'School of Mice':
  2799. case 'Mermouse Den':
  2800. case 'Lost Ruins':
  2801. returnZone = objSCZone.ZONE_SCALE;
  2802. break;
  2803. case 'Rocky Outcrop':
  2804. case 'Shipwreck':
  2805. case 'Haunted Shipwreck':
  2806. returnZone = objSCZone.ZONE_BARNACLE;
  2807. break;
  2808. case 'Shallow Shoals':
  2809. case 'Sea Floor':
  2810. case 'Murky Depths':
  2811. returnZone = objSCZone.ZONE_DEFAULT;
  2812. break;
  2813. default:
  2814. returnZone = objSCZone.ZONE_NOT_DIVE;
  2815. break;
  2816. }
  2817. return returnZone;
  2818. }
  2819.  
  2820. function labyrinth() {
  2821. if (GetCurrentLocation().indexOf("Labyrinth") < 0)
  2822. return;
  2823.  
  2824. var labyStatus = getPageVariable("user.quests.QuestLabyrinth.status");
  2825. var isAtEntrance = (labyStatus=="intersection entrance");
  2826. var isAtHallway = (labyStatus=="hallway");
  2827. var isAtIntersection = (labyStatus=="intersection");
  2828. var isAtExit = (labyStatus=="exit");
  2829. var lastHunt = document.getElementsByClassName('labyrinthHUD-hallway-tile locked').length + 1;
  2830. var totalClue = parseInt(document.getElementsByClassName('labyrinthHUD-clueBar-totalClues')[0].innerText);
  2831. console.plog("Entrance:", isAtEntrance, "Intersection:", isAtIntersection, "Exit:", isAtExit);
  2832. var objLaby = getStorageToObject('Labyrinth', objDefaultLaby);
  2833. console.plog('District to focus:', objLaby.districtFocus);
  2834. bestLabyBase = bestLabyBase.concat(objBestTrap.base.luck).concat(objBestTrap.base.power);
  2835. var charmArmed = getPageVariable('user.trinket_name');
  2836. if(objLaby.armOtherBase != 'false'){
  2837. if(charmArmed.indexOf('Compass Magnet') === 0)
  2838. checkThenArm(null, 'base', objLaby.armOtherBase);
  2839. else
  2840. checkThenArm('best', 'base', bestLabyBase);
  2841. }
  2842. else
  2843. checkThenArm('best', 'base', bestLabyBase);
  2844.  
  2845. var userVariable = undefined;
  2846. if(objLaby.disarmCompass && charmArmed.indexOf('Compass Magnet') > -1){
  2847. userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLabyrinth)'));
  2848. for (var i=0;i<userVariable.all_clues.length;i++){
  2849. if (userVariable.all_clues[i].name.toUpperCase().indexOf("DEAD") > -1){
  2850. if(userVariable.all_clues[i].quantity <= objLaby.nDeadEndClue)
  2851. disarmTrap('trinket');
  2852. break;
  2853. }
  2854. }
  2855. }
  2856.  
  2857. if(isAtHallway){
  2858. var strCurHallwayFullname = document.getElementsByClassName('labyrinthHUD-hallwayName')[0].textContent.toUpperCase();
  2859. if(strCurHallwayFullname.indexOf('FARMING') > -1){
  2860. if(objLaby.weaponFarming == 'Arcane')
  2861. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  2862. else
  2863. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2864. }
  2865. else
  2866. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2867. if(objLaby.securityDisarm){
  2868. var strCurHallwayTier = strCurHallwayFullname.split(' ')[1];
  2869. var maxCluePerHunt = 0;
  2870. if(strCurHallwayTier == 'PLAIN')
  2871. maxCluePerHunt = 1;
  2872. else if(strCurHallwayTier == 'SUPERIOR')
  2873. maxCluePerHunt = 2;
  2874. else
  2875. maxCluePerHunt = 3;
  2876. var classLantern = document.getElementsByClassName('labyrinthHUD-toggleLantern mousehuntTooltipParent');
  2877. var bLanternActive = true;
  2878. if(classLantern.length < 1)
  2879. bLanternActive = (getPageVariable('user.quests.QuestLabyrinth.lantern_status') == 'active');
  2880. else
  2881. bLanternActive = (classLantern[0].getAttribute('class').indexOf('inactive') < 0);
  2882. if(bLanternActive)
  2883. maxCluePerHunt++;
  2884. if(charmArmed.indexOf('Lantern Oil') > -1)
  2885. maxCluePerHunt++;
  2886. console.plog('Hallway Last Hunt :', lastHunt, 'Total Clues:', totalClue, 'Max Clue Per Hunt:', maxCluePerHunt);
  2887. if(lastHunt <= objLaby.lastHunt && totalClue >= (100-maxCluePerHunt*lastHunt))
  2888. disarmTrap('bait');
  2889. }
  2890. return;
  2891. }
  2892.  
  2893. if(isAtEntrance || isAtExit || objLaby.districtFocus.indexOf('None') > -1){
  2894. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2895. checkThenArm(null, 'bait', 'Gouda');
  2896. disarmTrap('trinket');
  2897. return;
  2898. }
  2899.  
  2900. var doorsIntersect = document.getElementsByClassName('labyrinthHUD-door');
  2901. var doorsExit = document.getElementsByClassName('labyrinthHUD-exit');
  2902. var objDoors = {
  2903. name : [],
  2904. length : [],
  2905. tier : [],
  2906. clue : [],
  2907. code : [],
  2908. priorities : [],
  2909. debug : []
  2910. };
  2911. var temp = "";
  2912. for (var i=0;i<doorsIntersect.length;i++){
  2913. if (doorsIntersect[i].getAttribute('class').indexOf('mystery') > -1){
  2914. isAtIntersection = false;
  2915. return;
  2916. }
  2917.  
  2918. if (doorsIntersect[i].getAttribute('class').indexOf('broken') > -1 || doorsIntersect[i].children.length<2){
  2919. objDoors.length.push("LONG");
  2920. objDoors.tier.push("PLAIN");
  2921. objDoors.name.push("BROKEN");
  2922. objDoors.debug.push("LONG PLAIN BROKEN");
  2923. objDoors.code.push("");
  2924. objDoors.clue.push(Number.MAX_SAFE_INTEGER);
  2925. objDoors.priorities.push(Number.MAX_SAFE_INTEGER);
  2926. }
  2927. else {
  2928. temp = doorsIntersect[i].children[1].innerText.toUpperCase();
  2929. objDoors.debug.push(temp);
  2930. temp = temp.split(" ");
  2931. objDoors.length.push(temp[0]);
  2932. objDoors.tier.push(temp[1]);
  2933. objDoors.name.push(temp[2]);
  2934. objDoors.code.push(objCodename[temp[0]] + objCodename[temp[1]]);
  2935. objDoors.clue.push(Number.MAX_SAFE_INTEGER);
  2936. objDoors.priorities.push(Number.MAX_SAFE_INTEGER);
  2937. }
  2938. isAtIntersection = true;
  2939. }
  2940.  
  2941. console.plog(objDoors.debug.join(","));
  2942. temp = "";
  2943. var range = "";
  2944. var index = [];
  2945. try {
  2946. if(isNullOrUndefined(userVariable))
  2947. userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLabyrinth)'));
  2948. for (var i=0;i<userVariable.all_clues.length;i++){
  2949. temp = userVariable.all_clues[i].name.toUpperCase();
  2950. if (temp.indexOf("DEAD") > -1)
  2951. continue;
  2952. index = getAllIndices(objDoors.name, temp);
  2953. for(var j=0;j<index.length;j++){
  2954. objDoors.clue[index[j]] = userVariable.all_clues[i].quantity;
  2955. }
  2956. }
  2957.  
  2958. index = objDoors.name.indexOf(objLaby.districtFocus);
  2959. if(index<0){
  2960. if(objLaby.chooseOtherDoors){
  2961. console.plog(objDoors);
  2962. temp = min(objDoors.clue);
  2963. var objFewestClue = {
  2964. num : temp,
  2965. indices : getAllIndices(objDoors.clue, temp),
  2966. count : countArrayElement(temp, objDoors.clue)
  2967. };
  2968. var objShortestLength = {
  2969. type : "SHORT",
  2970. indices : [],
  2971. count : 0
  2972. };
  2973. if(objDoors.length.indexOf("SHORT") > -1)
  2974. objShortestLength.type = "SHORT";
  2975. else if(objDoors.length.indexOf("MEDIUM") > -1)
  2976. objShortestLength.type = "MEDIUM";
  2977. else if(objDoors.length.indexOf("LONG") > -1)
  2978. objShortestLength.type = "LONG";
  2979. objShortestLength.indices = getAllIndices(objDoors.length, objShortestLength.type);
  2980. objShortestLength.count = objShortestLength.indices.length;
  2981. console.plog(JSON.stringify(objShortestLength));
  2982. console.plog(JSON.stringify(objFewestClue));
  2983. if(objShortestLength.indices.length < 1 || objFewestClue.indices.length < 1){
  2984. checkThenArm(null, 'bait', 'Gouda');
  2985. disarmTrap('trinket');
  2986. return;
  2987. }
  2988.  
  2989. var arrTemp = [];
  2990. var nMin = Number.MAX_SAFE_INTEGER;
  2991. var nMinIndex = -1;
  2992. if(objLaby.typeOtherDoors.indexOf("SHORTEST") === 0){ // SHORTEST_ONLY / SHORTEST_FEWEST
  2993. if(objShortestLength.count > 1 && objLaby.typeOtherDoors.indexOf("FEWEST") > -1){
  2994. for(var i=0;i<objShortestLength.indices.length;i++){
  2995. if(objDoors.clue[objShortestLength.indices[i]] < nMin){
  2996. nMin = objDoors.clue[objShortestLength.indices[i]];
  2997. nMinIndex = objShortestLength.indices[i];
  2998. }
  2999. }
  3000. if(nMinIndex > -1)
  3001. arrTemp.push(nMinIndex);
  3002. }
  3003. else
  3004. arrTemp = objShortestLength.indices;
  3005. }
  3006. else if(objLaby.typeOtherDoors.indexOf("FEWEST") === 0){ // FEWEST_ONLY / FEWEST_SHORTEST
  3007. if(objFewestClue.count > 1 && objLaby.typeOtherDoors.indexOf("SHORTEST") > -1){
  3008. var strTemp = "";
  3009. for(var i=0;i<objFewestClue.indices.length;i++){
  3010. strTemp = objDoors.length[objFewestClue.indices[i]].toUpperCase();
  3011. if(objLength.hasOwnProperty(strTemp) && objLength[strTemp] < nMin){
  3012. nMin = objLength[strTemp];
  3013. nMinIndex = objFewestClue.indices[i];
  3014. }
  3015. }
  3016. if(nMinIndex > -1)
  3017. arrTemp.push(nMinIndex);
  3018. }
  3019. else
  3020. arrTemp = objFewestClue.indices;
  3021. }
  3022. for(var i=0;i<arrTemp.length;i++){
  3023. if(objDoors.name[arrTemp[i]].indexOf("BROKEN") < 0){
  3024. if(objDoors.name[arrTemp[i]].indexOf('FARMING') > -1){
  3025. if(objLaby.weaponFarming == 'Arcane')
  3026. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  3027. else
  3028. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3029. }
  3030. else
  3031. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3032. checkThenArm(null, 'bait', 'Gouda');
  3033. disarmTrap('trinket');
  3034. fireEvent(doorsIntersect[arrTemp[i]], 'click');
  3035. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3036. break;
  3037. }
  3038. }
  3039. }
  3040. else{
  3041. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3042. checkThenArm(null, 'bait', 'Gouda');
  3043. disarmTrap('trinket');
  3044. }
  3045. return;
  3046. }
  3047. else{
  3048. if(objDoors.clue[index]<15)
  3049. range = 'between0and14';
  3050. else if(objDoors.clue[index]<60)
  3051. range = 'between15and59';
  3052. else
  3053. range = 'between60and100';
  3054. }
  3055.  
  3056. var arr;
  3057. var arrAll = [];
  3058. for (var i=0;i<objLaby[range].length;i++){
  3059. // i = 0/1/2 = plain/superior/epic
  3060. arr = [];
  3061. for (var j=0;j<3;j++)
  3062. arr.push(j+1 + (objLaby[range].length-1-i)*3);
  3063.  
  3064. if(objLaby[range][i].indexOf(objCodename.LONG) === 0)
  3065. arrAll = arrAll.concat(arr.reverse());
  3066. else
  3067. arrAll = arrAll.concat(arr);
  3068. }
  3069.  
  3070. for (var i=arrAll.length;i<arrHallwayOrder.length;i++)
  3071. arrAll.push(Number.MAX_SAFE_INTEGER);
  3072.  
  3073. for (var i=0;i<objDoors.code.length;i++){
  3074. if(objDoors.name[i].indexOf(objLaby.districtFocus)>-1){
  3075. index = arrHallwayOrder.indexOf(objDoors.code[i]);
  3076. if(index > -1){
  3077. objDoors.priorities[i] = arrAll[index];
  3078. }
  3079. }
  3080. }
  3081.  
  3082. console.plog(objDoors);
  3083. var sortedDoorPriorities = sortWithIndices(objDoors.priorities, "ascend");
  3084. fireEvent(doorsIntersect[sortedDoorPriorities.index[0]], 'click');
  3085. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3086. if(objLaby.districtFocus.indexOf('FARMING') > -1){
  3087. if(objLaby.weaponFarming == 'Arcane')
  3088. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  3089. else
  3090. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3091. }
  3092. else
  3093. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3094. }
  3095. catch (e){
  3096. console.perror('labyrinth',e.message);
  3097. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3098. checkThenArm(null, 'bait', 'Gouda');
  3099. disarmTrap('trinket');
  3100. return;
  3101. }
  3102. }
  3103.  
  3104. function zokor(){
  3105. var loc = GetCurrentLocation();
  3106. if (loc.indexOf("Labyrinth") > -1){
  3107. setStorage('eventLocation', 'Labyrinth');
  3108. labyrinth();
  3109. return;
  3110. }
  3111. else if (loc.indexOf("Zokor") < 0)
  3112. return;
  3113.  
  3114. var objDefaultZokor = {
  3115. bossStatus : ['INCOMING', 'ACTIVE', 'DEFEATED'],
  3116. bait : new Array(3).fill('Gouda'),
  3117. trinket : new Array(3).fill('None')
  3118. };
  3119. var objZokor = getStorageToObject('Zokor', objDefaultZokor);
  3120. var objAncientCity = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestAncientCity)'));
  3121. objAncientCity.boss = objAncientCity.boss.toUpperCase();
  3122. var nIndex = objZokor.bossStatus.indexOf(objAncientCity.boss);
  3123. console.plog('District Tier:', objAncientCity.district_tier, 'Boss Status:', objAncientCity.boss);
  3124. if(objAncientCity.district_tier < 3)
  3125. return;
  3126.  
  3127. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3128. checkThenArm('best', 'base', objBestTrap.base.luck);
  3129. if(nIndex > -1){
  3130. checkThenArm(null, 'bait', objZokor.bait[nIndex]);
  3131. if(objZokor.trinket[nIndex] == 'None')
  3132. disarmTrap('trinket');
  3133. else
  3134. checkThenArm(null, 'trinket', objZokor.trinket[nIndex]);
  3135. }
  3136. }
  3137.  
  3138. function fw(){
  3139. if (GetCurrentLocation().indexOf("Fiery Warpath") < 0)
  3140. return;
  3141.  
  3142. var wave = getPageVariable('user.viewing_atts.desert_warpath.wave');
  3143. wave = parseInt(wave);
  3144. var objDefaultFWAll = {
  3145. wave1 : JSON.parse(JSON.stringify(objDefaultFW)),
  3146. wave2 : JSON.parse(JSON.stringify(objDefaultFW)),
  3147. wave3 : JSON.parse(JSON.stringify(objDefaultFW)),
  3148. wave4 : JSON.parse(JSON.stringify(objDefaultFW)),
  3149. };
  3150. var objFWAll = getStorageToObject('FW', objDefaultFWAll);
  3151. var temp = false;
  3152. for(var prop in objFWAll){
  3153. if(objFWAll.hasOwnProperty(prop)){
  3154. if(assignMissingDefault(objFWAll[prop], objDefaultFW))
  3155. temp = true;
  3156. }
  3157. }
  3158. if(temp)
  3159. setStorage('FW', JSON.stringify(objFWAll));
  3160. var objFW = objFWAll['wave'+wave];
  3161. if (wave == 4){
  3162. var nWardenLeft = parseInt(document.getElementsByClassName('warpathHUD-wave wave_4')[0].getElementsByClassName('warpathHUD-wave-mouse-population')[0].textContent);
  3163. console.plog('Wave:', wave, 'Warden Left:', nWardenLeft);
  3164. if(Number.isNaN(nWardenLeft))
  3165. nWardenLeft = 12;
  3166. temp = (nWardenLeft <= 0) ? "after" : "before";
  3167. checkThenArm(null, 'weapon', objFW.warden[temp].weapon);
  3168. checkThenArm(null, 'base', objFW.warden[temp].base);
  3169. checkThenArm(null, 'trinket', objFW.warden[temp].trinket);
  3170. checkThenArm(null, 'bait', objFW.warden[temp].bait);
  3171. return;
  3172. }
  3173.  
  3174. checkThenArm(null, 'base', objFW.base);
  3175. objFW.streak = parseInt(document.getElementsByClassName('warpathHUD-streak-quantity')[0].innerText);
  3176. console.plog('Wave:', wave, 'Streak:', objFW.streak);
  3177. if(Number.isNaN(objFW.streak) || objFW.streak < 0 || objFW.streak >= g_fwStreakLength)
  3178. return;
  3179.  
  3180. if(isNullOrUndefined(objFW.cheese[objFW.streak]))
  3181. objFW.cheese[objFW.streak] = 'Gouda';
  3182. if(isNullOrUndefined(objFW.charmType[objFW.streak]))
  3183. objFW.charmType[objFW.streak] = 'Warpath';
  3184. if(isNullOrUndefined(objFW.special[objFW.streak]))
  3185. objFW.special[objFW.streak] = 'None';
  3186.  
  3187. objFW.streakMouse = getPageVariable('user.viewing_atts.desert_warpath.streak_type');
  3188. if(objFW.streakMouse.indexOf('desert_') > -1)
  3189. objFW.streakMouse = capitalizeFirstLetter(objFW.streakMouse.split('_')[1]);
  3190.  
  3191. console.plog('Current streak mouse type:', objFW.streakMouse);
  3192. var population = document.getElementsByClassName('warpathHUD-wave wave_' + wave.toString())[0].getElementsByClassName('warpathHUD-wave-mouse-population');
  3193. objFW.population = {
  3194. all : [],
  3195. normal : [],
  3196. special : [],
  3197. active : []
  3198. };
  3199. objFW.soldierActive = false;
  3200. var charmName;
  3201. for(var i=0;i<population.length;i++){
  3202. temp = parseInt(population[i].innerText);
  3203. if(Number.isNaN(temp))
  3204. temp = 0;
  3205. objFW.population.all.push(temp);
  3206. if(temp > 0)
  3207. objFW.population.active.push(1);
  3208. else
  3209. objFW.population.active.push(0);
  3210. if(i == objPopulation.WARRIOR || i == objPopulation.SCOUT || i == objPopulation.ARCHER){
  3211. objFW.population.normal.push(temp);
  3212. objFW.soldierActive |= (temp > 0);
  3213. }
  3214. else{
  3215. objFW.population.special.push(temp);
  3216. }
  3217. }
  3218.  
  3219. if(!objFW.soldierActive && objFW.focusType == 'NORMAL')
  3220. objFW.focusType = 'SPECIAL';
  3221.  
  3222. console.plog(objFW);
  3223. var index = -1;
  3224. var charmArmed = getPageVariable('user.trinket_name');
  3225. var nSum;
  3226. if(wave == 3 && !objFW.includeArtillery){
  3227. var arrTemp = objFW.population.active.slice();
  3228. arrTemp[objPopulation.ARTILLERY] = 0;
  3229. nSum = sumData(arrTemp);
  3230. if(nSum < 1)
  3231. nSum = 1;
  3232. }
  3233. else
  3234. nSum = sumData(objFW.population.active);
  3235. if(nSum == 1){ // only one soldier type left
  3236. if(objFW.lastSoldierConfig == 'CONFIG_STREAK')
  3237. objFW.priorities = 'HIGHEST';
  3238. else if(objFW.lastSoldierConfig == 'CONFIG_UNCHANGED')
  3239. return;
  3240. else if(objFW.lastSoldierConfig == 'CONFIG_GOUDA' || objFW.lastSoldierConfig == 'NO_WARPATH'){
  3241. index = objFW.population.active.indexOf(1);
  3242. if(index == objPopulation.CAVALRY)
  3243. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3244. else if(index == objPopulation.MAGE)
  3245. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3246. else if(index == objPopulation.ARTILLERY)
  3247. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3248. else
  3249. checkThenArm(null, 'weapon', objFW.weapon);
  3250. if(charmArmed.indexOf('Warpath') > -1)
  3251. disarmTrap('trinket');
  3252. if(objFW.lastSoldierConfig == 'CONFIG_GOUDA')
  3253. checkThenArm(null, 'bait', 'Gouda');
  3254. return;
  3255. }
  3256. }
  3257. if(objFW.special[objFW.streak] == 'COMMANDER'){
  3258. checkThenArm(null, 'weapon', objFW.weapon);
  3259. if(objFW.charmType[objFW.streak].indexOf('Super') > -1)
  3260. charmName = ["Super Warpath Commander's Charm", "Warpath Commander's Charm"];
  3261. else
  3262. charmName = "Warpath Commander's Charm";
  3263. }
  3264. else if(objFW.special[objFW.streak].indexOf('GARGANTUA') === 0){
  3265. checkThenArm('best', 'weapon', objBestTrap.weapon.draconic);
  3266. if(objFW.special[objFW.streak] == 'GARGANTUA_GGC' && objFW.streak >= 7)
  3267. charmName = 'Gargantua Guarantee Charm';
  3268. else
  3269. charmName = (charmArmed.indexOf('Warpath') > -1) ? 'None' : undefined;
  3270. }
  3271. else{
  3272. var bCurrentStreakZeroPopulation = false;
  3273. var bWrongSoldierTypeStreak = false;
  3274. var indexMinMax;
  3275. objFW.focusType = objFW.focusType.toLowerCase();
  3276. if(objFW.priorities == 'HIGHEST')
  3277. indexMinMax = maxIndex(objFW.population[objFW.focusType]);
  3278. else{
  3279. for(var i=0;i<objFW.population[objFW.focusType].length;i++){
  3280. if(objFW.population[objFW.focusType][i] < 1)
  3281. objFW.population[objFW.focusType][i] = Number.MAX_SAFE_INTEGER;
  3282. }
  3283. indexMinMax = minIndex(objFW.population[objFW.focusType]);
  3284. }
  3285. index = objPopulation.name.indexOf(objFW.streakMouse);
  3286. if(index > -1){
  3287. bCurrentStreakZeroPopulation = (objFW.population.all[index] < 1);
  3288. if(objFW.soldierActive && index >=3 && objFW.focusType.toUpperCase() == 'NORMAL'){
  3289. bWrongSoldierTypeStreak = !(objFW.streak == 2 || objFW.streak >= 5);
  3290. }
  3291. else if(!objFW.soldierActive && objFW.focusType.toUpperCase() == 'SPECIAL'){
  3292. bWrongSoldierTypeStreak = (index != (indexMinMax+3) && objFW.streak < 2);
  3293. }
  3294. }
  3295.  
  3296. if(objFW.streak === 0 || bCurrentStreakZeroPopulation || bWrongSoldierTypeStreak){
  3297. objFW.streak = 0;
  3298. temp = objFW.population[objFW.focusType][indexMinMax];
  3299. if(objFW.focusType.toUpperCase() == 'NORMAL'){
  3300. checkThenArm(null, 'weapon', objFW.weapon);
  3301. var count = countArrayElement(temp, objFW.population[objFW.focusType]);
  3302. if(count > 1){
  3303. if(objFW.population[objFW.focusType][objPopulation.SCOUT] == temp)
  3304. charmName = objFW.charmType[0] + ' Scout';
  3305. else if(objFW.population[objFW.focusType][objPopulation.ARCHER] == temp)
  3306. charmName = objFW.charmType[0] + ' Archer';
  3307. else if(objFW.population[objFW.focusType][objPopulation.WARRIOR] == temp)
  3308. charmName = objFW.charmType[0] + ' Warrior';
  3309. }
  3310. else{
  3311. charmName = objFW.charmType[0] + ' ' + objPopulation.name[indexMinMax];
  3312. }
  3313. }
  3314. else{
  3315. if((indexMinMax+3) == objPopulation.ARTILLERY && nSum !=1){
  3316. temp = objFW.population.special.slice();
  3317. temp.splice(indexMinMax,1);
  3318. if(objFW.priorities == 'HIGHEST')
  3319. indexMinMax = maxIndex(temp);
  3320. else
  3321. indexMinMax = minIndex(temp);
  3322. }
  3323. indexMinMax += 3;
  3324. if(indexMinMax == objPopulation.CAVALRY){
  3325. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3326. charmName = objFW.charmType[0] + ' Cavalry';
  3327. }
  3328. else if(indexMinMax == objPopulation.MAGE){
  3329. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3330. charmName = objFW.charmType[0] + ' Mage';
  3331. }
  3332. else if(indexMinMax == objPopulation.ARTILLERY){
  3333. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3334. if(charmArmed.indexOf('Warpath') > -1)
  3335. charmName = 'None';
  3336. else
  3337. charmName = undefined;
  3338. }
  3339. }
  3340. }
  3341. else{ // streak 1 and above
  3342. if(index == objPopulation.ARTILLERY && charmArmed.indexOf('Warpath') > -1)
  3343. charmName = 'None';
  3344. else{
  3345. if(objFW.charmType[objFW.streak].indexOf('Super') > -1)
  3346. charmName = [objFW.charmType[objFW.streak] + ' ' + objPopulation.name[index], 'Warpath ' + objPopulation.name[index]];
  3347. else
  3348. charmName = objFW.charmType[objFW.streak] + ' ' + objPopulation.name[index];
  3349. }
  3350.  
  3351. if(index == objPopulation.CAVALRY)
  3352. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3353. else if(index == objPopulation.MAGE)
  3354. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3355. else if(index == objPopulation.ARTILLERY)
  3356. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3357. else
  3358. checkThenArm(null, 'weapon', objFW.weapon);
  3359. }
  3360. }
  3361. checkThenArm(null, 'bait', objFW.cheese[objFW.streak]);
  3362. if(objFW.disarmAfterSupportRetreat && sumData(objFW.population.all) <= g_arrFWSupportRetreat[wave]){
  3363. if(charmArmed.indexOf('Warpath') > -1)
  3364. disarmTrap('trinket');
  3365. }
  3366. else
  3367. checkThenArm('best', 'trinket', charmName);
  3368. }
  3369.  
  3370. function fRift(){
  3371. if(GetCurrentLocation().indexOf('Furoma Rift') < 0)
  3372. return;
  3373.  
  3374. var objDefaultFR = {
  3375. enter : 0,
  3376. retreat : 0,
  3377. weapon : new Array(11).fill(''),
  3378. base : new Array(11).fill(''),
  3379. trinket : new Array(11).fill(''),
  3380. bait : new Array(11).fill(''),
  3381. masterOrder : new Array(11).fill('Glutter=>Combat=>Susheese')
  3382. };
  3383. var objFR = getStorageToObject('FRift', objDefaultFR);
  3384. objFR.enter = parseInt(objFR.enter);
  3385. objFR.retreat = parseInt(objFR.retreat);
  3386. var objUserFRift = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestRiftFuroma)'));
  3387. console.plog(objUserFRift.view_state);
  3388. var bInPagoda = (objUserFRift.view_state == 'pagoda' || objUserFRift.view_state == 'pagoda knows_all');
  3389. var i;
  3390. if(bInPagoda){
  3391. var nCurBatteryLevel = 0;
  3392. var nRemainingEnergy = parseInt(getPageVariable('user.quests.QuestRiftFuroma.droid.remaining_energy').replace(/,/g, ''));
  3393. if(Number.isNaN(nRemainingEnergy)){
  3394. console.plog('Remaining Energy:', nRemainingEnergy);
  3395. return;
  3396. }
  3397. for(i=objFRBattery.cumulative.length-1;i>=0;i--){
  3398. if(nRemainingEnergy <= objFRBattery.cumulative[i])
  3399. nCurBatteryLevel = i+1;
  3400. else
  3401. break;
  3402. }
  3403. console.plog('In Pagoda, Current Battery Level:', nCurBatteryLevel, 'Remaining Energy:', nRemainingEnergy);
  3404. if(nCurBatteryLevel <= objFR.retreat){
  3405. fRiftArmTrap(objFR, 0);
  3406. if(nCurBatteryLevel !== 0){
  3407. // retreat
  3408. fireEvent(document.getElementsByClassName('riftFuromaHUD-leavePagoda')[0], 'click');
  3409. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3410. }
  3411. }
  3412. else{
  3413. fRiftArmTrap(objFR, nCurBatteryLevel);
  3414. }
  3415. }
  3416. else{
  3417. var nFullBatteryLevel = 0;
  3418. var classBattery = document.getElementsByClassName('riftFuromaHUD-battery');
  3419. var nStoredEnerchi = parseInt(document.getElementsByClassName('total_energy')[0].children[1].innerText.replace(/,/g, ''));
  3420. if(classBattery.length < 1 || Number.isNaN(nStoredEnerchi)){
  3421. console.plog('Stored Enerchi:',nStoredEnerchi);
  3422. return;
  3423. }
  3424. for(i=0;i<objFRBattery.cumulative.length;i++){
  3425. if(nStoredEnerchi >= objFRBattery.cumulative[i])
  3426. nFullBatteryLevel = i+1;
  3427. else
  3428. break;
  3429. }
  3430. console.plog('In Training Ground, Fully Charged Battery Level:', nFullBatteryLevel, 'Stored Enerchi:', nStoredEnerchi);
  3431. if(Number.isInteger(objFR.enter) && nFullBatteryLevel >= objFR.enter){
  3432. fRiftArmTrap(objFR, objFR.enter);
  3433. // enter
  3434. fireEvent(classBattery[objFR.enter-1], 'click');
  3435. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3436. }
  3437. else{
  3438. fRiftArmTrap(objFR, 0);
  3439. }
  3440. }
  3441. }
  3442.  
  3443. function fRiftArmTrap(obj, nIndex, bReadJournal){
  3444. if(isNullOrUndefined(bReadJournal))
  3445. bReadJournal = true;
  3446. checkThenArm(null, 'weapon', obj.weapon[nIndex]);
  3447. checkThenArm(null, 'base', obj.base[nIndex]);
  3448. checkThenArm(null, 'trinket', obj.trinket[nIndex]);
  3449. if(obj.bait[nIndex] == 'ANY_MASTER')
  3450. checkThenArm('any', 'bait', 'ANY_MASTER');
  3451. else if(obj.bait[nIndex] == 'ORDER_MASTER'){
  3452. var arr = obj.masterOrder[nIndex].split("=>");
  3453. arr = arr.map(function(e) {return 'Rift ' + e;});
  3454. checkThenArm('best', 'bait', arr);
  3455. }
  3456. else if(obj.bait[nIndex] == 'BALANCE_MASTER'){
  3457. if(g_arrHeirloom.length === 0){
  3458. var nRetry = 4;
  3459. var bFirst = true;
  3460. var intervalFRAT = setInterval( function () {
  3461. if (document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabContent pinnacle').length > 0){
  3462. fireEvent(document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabHeader')[3],'click'); // close
  3463. var classPinnacle = document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabContent pinnacle');
  3464. var i,temp;
  3465. for(i=0;i<3;i++){
  3466. temp = classPinnacle[0].getElementsByClassName('riftFuromaHUD-craftingPopup-recipe-part')[i];
  3467. g_arrHeirloom.push(parseInt(temp.getAttribute('data-part-owned')));
  3468. if(Number.isNaN(g_arrHeirloom[i])){
  3469. console.plog('Invalid Heirloom:', g_arrHeirloom);
  3470. checkThenArm('any', 'bait', 'ANY_MASTER');
  3471. return;
  3472. }
  3473. }
  3474. if(g_arrHeirloom.length != 3){
  3475. console.plog('Invalid length:', g_arrHeirloom);
  3476. checkThenArm('any', 'bait', 'ANY_MASTER');
  3477. return;
  3478. }
  3479. setStorage('LastRecordedJournalFRift', document.getElementsByClassName('journaltext')[0].parentNode.textContent);
  3480. fRiftArmTrap(obj, nIndex, false);
  3481. clearInterval(intervalFRAT);
  3482. intervalFRAT = null;
  3483. }
  3484. else{
  3485. fireEvent(document.getElementsByClassName('riftFuromaHUD-itemGroup-craftButton')[3],'click');
  3486. --nRetry;
  3487. if(nRetry <= 0){
  3488. console.plog('Max Retry, arm any Rift Master Cheese');
  3489. checkThenArm('any', 'bait', 'ANY_MASTER');
  3490. clearInterval(intervalFRAT);
  3491. intervalFRAT = null;
  3492. }
  3493. }
  3494. }, 1000);
  3495. }
  3496. else{
  3497. if(bReadJournal === true)
  3498. getJournalDetailFRift();
  3499. console.plog('Heirloom:', g_arrHeirloom);
  3500. var arrBait = g_objConstTrap.bait.ANY_MASTER.name;
  3501. var nMin = min(g_arrHeirloom);
  3502. var fAvg = average(g_arrHeirloom);
  3503. if(fAvg == nMin){
  3504. checkThenArm('any', 'bait', 'ANY_MASTER');
  3505. }
  3506. else{
  3507. temp = minIndex(g_arrHeirloom);
  3508. if(temp > -1){
  3509. var arrBaitNew = [];
  3510. var objSort = sortWithIndices(g_arrHeirloom);
  3511. for(i=0;i<objSort.index.length;i++){
  3512. arrBaitNew[i] = arrBait[objSort.index[i]];
  3513. }
  3514. console.plog('New Bait List:', arrBaitNew);
  3515. checkThenArm('best', 'bait', arrBaitNew);
  3516. }
  3517. else{
  3518. console.plog('Invalid index:', temp);
  3519. checkThenArm('any', 'bait', 'ANY_MASTER');
  3520. }
  3521. }
  3522. }
  3523. }
  3524. else
  3525. checkThenArm(null, 'bait', obj.bait[nIndex]);
  3526. }
  3527.  
  3528. function livingGarden(obj) {
  3529. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3530. var charmArmed = getPageVariable('user.trinket_name');
  3531. var baitArmed = getPageVariable('user.bait_name');
  3532. var pourEstimate = document.getElementsByClassName('pourEstimate')[0];
  3533. var estimateHunt = parseInt(pourEstimate.innerText);
  3534. var strStatus = '';
  3535. if(Number.isNaN(estimateHunt))
  3536. strStatus = 'Poured';
  3537. else if(estimateHunt >= 35)
  3538. strStatus = 'Filled';
  3539. else
  3540. strStatus = 'Filling';
  3541. console.plog('Estimate Hunt:', estimateHunt, 'Status:', strStatus);
  3542. if (obj.LG.trinket.after.indexOf('Sponge') > -1)
  3543. obj.LG.trinket.after = 'None';
  3544. if(strStatus == 'Poured'){
  3545. checkThenArm(null, 'base', obj.LG.base.after);
  3546. checkThenArm(null, 'trinket', obj.LG.trinket.after);
  3547. checkThenArm(null, 'bait', obj.LG.bait.after);
  3548. }
  3549. else if(strStatus == 'Filled'){
  3550. var pourButton = document.getElementsByClassName('pour')[0];
  3551. if(obj.LG.isAutoPour && !isNullOrUndefined(pourButton)){
  3552. fireEvent(pourButton, 'click');
  3553. if (document.getElementsByClassName('confirm button')[0]){
  3554. window.setTimeout(function () { fireEvent(document.getElementsByClassName('confirm button')[0], 'click'); }, 1000);
  3555. checkThenArm(null, 'base', obj.LG.base.after);
  3556. checkThenArm(null, 'trinket', obj.LG.trinket.after);
  3557. checkThenArm(null, 'bait', obj.LG.bait.after);
  3558. }
  3559. else{
  3560. checkThenArm('best', 'base', bestLGBase);
  3561. if (charmArmed.indexOf('Sponge') > -1)
  3562. disarmTrap('trinket');
  3563. if (baitArmed.indexOf('Camembert') > -1)
  3564. checkThenArm(null, 'bait', 'Gouda');
  3565. }
  3566. }
  3567. else{
  3568. checkThenArm('best', 'base', bestLGBase);
  3569. if (charmArmed.indexOf('Sponge') > -1)
  3570. disarmTrap('trinket');
  3571. if (baitArmed.indexOf('Camembert') > -1)
  3572. checkThenArm(null, 'bait', 'Gouda');
  3573. }
  3574. }
  3575. else if(strStatus == 'Filling'){
  3576. checkThenArm('best', 'base', bestLGBase);
  3577. if(!obj.LG.isAutoFill){
  3578. if (charmArmed.indexOf('Sponge') > -1 ||
  3579. obj.LG.trinket.after.indexOf(charmArmed) > -1 || charmArmed.indexOf(obj.LG.trinket.after) > -1)
  3580. disarmTrap('trinket');
  3581. }
  3582. else{
  3583. if (estimateHunt >= 28)
  3584. checkThenArm(null, 'trinket', 'Sponge');
  3585. else
  3586. checkThenArm('best', 'trinket', spongeCharm);
  3587. }
  3588. if (baitArmed.indexOf('Camembert') > -1 && baitArmed.indexOf('Duskshade') < 0)
  3589. checkThenArm(null, 'bait', 'Gouda');
  3590. }
  3591. }
  3592.  
  3593. function lostCity(obj) {
  3594. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3595. checkThenArm(null, 'bait', 'Dewthief');
  3596. var isCursed = (document.getElementsByClassName('stateBlessed hidden').length > 0);
  3597. console.plog('Cursed:', isCursed);
  3598.  
  3599. //disarm searcher charm when cursed is lifted
  3600. if (!isCursed) {
  3601. checkThenArm(null, 'base', obj.LG.base.after);
  3602. if (obj.LC.trinket.after.indexOf('Searcher') > -1)
  3603. obj.LC.trinket.after = 'None';
  3604. checkThenArm(null, 'trinket', obj.LC.trinket.after);
  3605. }
  3606. else{
  3607. checkThenArm(null, 'trinket', 'Searcher');
  3608. checkThenArm('best', 'base', bestLGBase);
  3609. }
  3610. }
  3611.  
  3612. function sandDunes() {
  3613. var hasStampede = getPageVariable('user.quests.QuestSandDunes.minigame.has_stampede');
  3614. console.plog('Has Stampede:', hasStampede);
  3615.  
  3616. //disarm grubling chow charm when there is no stampede
  3617. if (hasStampede == 'false'){
  3618. if (getPageVariable('user.trinket_name').indexOf('Chow') > -1)
  3619. disarmTrap('trinket');
  3620. }
  3621. else
  3622. checkThenArm(null, 'trinket', 'Grubling Chow');
  3623. checkThenArm('best', 'weapon', objBestTrap.weapon.shadow);
  3624. checkThenArm('best', 'base', bestLGBase);
  3625. checkThenArm(null, 'bait', 'Dewthief');
  3626. }
  3627.  
  3628. function twistedGarden(obj) {
  3629. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3630. var red = parseInt(document.getElementsByClassName('itemImage red')[0].innerText);
  3631. var yellow = parseInt(document.getElementsByClassName('itemImage yellow')[0].innerText);
  3632. var nEstimateHunt = -1;
  3633. var charmArmed = getPageVariable('user.trinket_name');
  3634. var strStatus = '';
  3635. if(Number.isNaN(red) || Number.isNaN(yellow) || document.getElementsByClassName('stateFilling hidden').length > 0){
  3636. strStatus = 'Poured';
  3637. nEstimateHunt = parseInt(document.getElementsByClassName('pouring')[0].textContent);
  3638. }
  3639. else if(red == 10 && yellow == 10)
  3640. strStatus = 'Filled';
  3641. else
  3642. strStatus = 'Filling';
  3643. console.plog('Red:', red, 'Yellow:', yellow, 'Estimate Hunt:', nEstimateHunt, 'Status:', strStatus);
  3644. var redPlusYellow = redSpongeCharm.concat(yellowSpongeCharm);
  3645. if (obj.TG.trinket.after.indexOf('Red') > -1 || obj.TG.trinket.after.indexOf('Yellow') > -1)
  3646. obj.TG.trinket.after = 'None';
  3647. if(strStatus == 'Poured'){
  3648. checkThenArm(null, 'base', obj.TG.base.after);
  3649. checkThenArm(null, 'trinket', obj.TG.trinket.after);
  3650. checkThenArm(null, 'bait', obj.TG.bait.after);
  3651. }
  3652. else if(strStatus == 'Filled'){
  3653. var pourButton = document.getElementsByClassName('pour')[0];
  3654. if(obj.TG.isAutoPour && !isNullOrUndefined(pourButton)){
  3655. fireEvent(pourButton, 'click');
  3656. if (document.getElementsByClassName('confirm button')[0]){
  3657. window.setTimeout(function () { fireEvent(document.getElementsByClassName('confirm button')[0], 'click'); }, 1000);
  3658. checkThenArm(null, 'base', obj.TG.base.after);
  3659. checkThenArm(null, 'trinket', obj.TG.trinket.after);
  3660. checkThenArm(null, 'bait', obj.TG.bait.after);
  3661. }
  3662. else{
  3663. checkThenArm('best', 'base', bestLGBase);
  3664. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1)
  3665. disarmTrap('trinket');
  3666. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3667. }
  3668. }
  3669. else{
  3670. checkThenArm('best', 'base', bestLGBase);
  3671. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1)
  3672. disarmTrap('trinket');
  3673. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3674. }
  3675. }
  3676. else if(strStatus == 'Filling'){
  3677. checkThenArm('best', 'base', bestLGBase);
  3678. if(!obj.TG.isAutoFill){
  3679. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1 ||
  3680. obj.TG.trinket.after.indexOf(charmArmed) > -1 || charmArmed.indexOf(obj.TG.trinket.after) > -1)
  3681. disarmTrap('trinket');
  3682. }
  3683. else{
  3684. if (red <= 8 && yellow <= 8)
  3685. checkThenArm('best', 'trinket', redPlusYellow);
  3686. else if (red < 10){
  3687. if (red <= 8)
  3688. checkThenArm('best', 'trinket', redSpongeCharm);
  3689. else
  3690. checkThenArm(null, 'trinket', 'Red Sponge');
  3691. }
  3692. else if (red == 10 && yellow < 10){
  3693. if (yellow <=8)
  3694. checkThenArm('best', 'trinket', yellowSpongeCharm);
  3695. else
  3696. checkThenArm(null, 'trinket', 'Yellow Sponge');
  3697. }
  3698. }
  3699. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3700. }
  3701. }
  3702.  
  3703. function cursedCity(obj) {
  3704. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3705. checkThenArm(null, 'bait', 'Graveblossom');
  3706. var objCC = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLostCity.minigame)'));
  3707. var curses = "";
  3708. var charmArmed = getPageVariable('user.trinket_name');
  3709. console.plog(objCC);
  3710. if (objCC.is_cursed === false){
  3711. checkThenArm(null, 'base', obj.CC.base.after);
  3712. if (obj.CC.trinket.after.indexOf('Bravery') > -1 || obj.CC.trinket.after.indexOf('Shine') > -1 || obj.CC.trinket.after.indexOf('Clarity') > -1)
  3713. obj.CC.trinket.after = 'None';
  3714. checkThenArm(null, 'trinket', obj.CC.trinket.after);
  3715. }
  3716. else{
  3717. var cursedCityCharm = [];
  3718. for (var i = 0; i < objCC.curses.length; ++i){
  3719. console.plog("i:", i, "Active:", objCC.curses[i].active);
  3720. if(objCC.curses[i].active){
  3721. switch (i){
  3722. case 0:
  3723. console.plog("Fear Active");
  3724. cursedCityCharm.push('Bravery');
  3725. break;
  3726. case 1:
  3727. console.plog("Darkness Active");
  3728. cursedCityCharm.push('Shine');
  3729. break;
  3730. case 2:
  3731. console.plog("Mist Active");
  3732. cursedCityCharm.push('Clarity');
  3733. break;
  3734. }
  3735. }
  3736. }
  3737. checkThenArm('any', 'trinket', cursedCityCharm);
  3738. checkThenArm('best', 'base', bestLGBase);
  3739. }
  3740. }
  3741.  
  3742. function sandCrypts(obj) {
  3743. checkThenArm('best', 'weapon', objBestTrap.weapon.shadow);
  3744. checkThenArm(null, 'bait', 'Graveblossom');
  3745. var salt = parseInt(document.getElementsByClassName('salt_charms')[0].innerText);
  3746. console.plog('Salted:', salt);
  3747. if (salt >= obj.SC.maxSaltCharged){
  3748. checkThenArm(null, 'base', obj.SC.base.after);
  3749. checkThenArm(null, 'trinket', 'Grub Scent');
  3750. }
  3751. else {
  3752. checkThenArm(null, 'base', obj.SC.base.before);
  3753. if ((obj.SC.maxSaltCharged - salt) == 1)
  3754. checkThenArm(null, 'trinket', 'Grub Salt');
  3755. else
  3756. checkThenArm('best', 'trinket', bestSalt);
  3757. }
  3758. }
  3759.  
  3760. function DisarmLGSpecialCharm(locationName)
  3761. {
  3762. var obj = {};
  3763. obj['Living Garden'] = spongeCharm.slice();
  3764. obj['Lost City'] = ['Searcher'];
  3765. obj['Sand Dunes'] = ['Grubling Chow'];
  3766. obj['Twisted Garden'] = redSpongeCharm.concat(yellowSpongeCharm);
  3767. obj['Cursed City'] = ['Bravery', 'Shine', 'Clarity'];
  3768. obj['Sand Crypts'] = bestSalt.slice();
  3769. delete obj[locationName];
  3770. var charmArmed = getPageVariable("user.trinket_name");
  3771. for (var prop in obj)
  3772. {
  3773. if(obj.hasOwnProperty(prop))
  3774. {
  3775. for (var i = 0; i < obj[prop].length; ++i)
  3776. {
  3777. if (charmArmed.indexOf(obj[prop][i]) === 0)
  3778. {
  3779. disarmTrap('trinket');
  3780. return;
  3781. }
  3782. }
  3783. }
  3784. }
  3785. }
  3786.  
  3787. function retrieveMouseList() {
  3788. fireEvent(document.getElementById('effectiveness'), 'click');
  3789. var sec = secWait;
  3790. var intervalRML = setInterval(
  3791. function () {
  3792. if (document.getElementsByClassName('thumb').length > 0)
  3793. {
  3794. mouseList = [];
  3795. var y = document.getElementsByClassName('thumb');
  3796. for (var i = 0; i < y.length; ++i) {
  3797. mouseList.push(y[i].getAttribute('title'));
  3798. }
  3799. fireEvent(document.getElementById('trapSelectorBrowserClose'), 'click');
  3800. clearInterval(intervalRML);
  3801. intervalRML = null;
  3802. return;
  3803. }
  3804. else
  3805. {
  3806. --sec;
  3807. if (sec <= 0) {
  3808. fireEvent(document.getElementById('effectiveness'), 'click');
  3809. sec = secWait;
  3810. }
  3811. }
  3812. }, 1000);
  3813. return;
  3814. }
  3815.  
  3816. function checkMouse(mouseName) {
  3817. for (var i = 0; i < mouseList.length; ++i) {
  3818. if (mouseList[i].indexOf(mouseName) > -1) {
  3819. return true;
  3820. }
  3821. return false;
  3822. }
  3823. }
  3824.  
  3825. function magicalPillowcase(){
  3826.  
  3827. }
  3828.  
  3829. function checkCharge2016(stopDischargeAt){
  3830. try {
  3831. var charge = parseInt(document.getElementsByClassName('springHuntHUD-charge-quantity')[0].innerText);
  3832. var isDischarge = (getStorage("discharge") == "true");
  3833. console.plog('Current Charge:', charge, 'Discharging:', isDischarge, 'Stop Discharge At:', stopDischargeAt);
  3834. var charmContainer = document.getElementsByClassName('springHuntHUD-charmContainer')[0];
  3835. var eggstra = {};
  3836. eggstra.quantity = parseInt(charmContainer.children[0].children[0].innerText);
  3837. eggstra.link = charmContainer.children[0].children[1];
  3838. eggstra.isArmed = (eggstra.link.getAttribute('class').indexOf('active') > 0);
  3839. eggstra.canArm = (eggstra.quantity > 0 && !eggstra.isArmed);
  3840. var eggstraCharge = {};
  3841. eggstraCharge.quantity = parseInt(charmContainer.children[1].children[0].innerText);
  3842. eggstraCharge.link = charmContainer.children[1].children[1];
  3843. eggstraCharge.isArmed = (eggstraCharge.link.getAttribute('class').indexOf('active') > 0);
  3844. eggstraCharge.canArm = (eggstraCharge.quantity > 0 && !eggstraCharge.isArmed);
  3845. var eggscavator = {};
  3846. eggscavator.quantity = parseInt(charmContainer.children[2].children[0].innerText);
  3847. eggscavator.link = charmContainer.children[2].children[1];
  3848. eggscavator.isArmed = (eggscavator.link.getAttribute('class').indexOf('active') > 0);
  3849. eggscavator.canArm = (eggscavator.quantity > 0 && !eggscavator.isArmed);
  3850.  
  3851. if (charge == 20) {
  3852. setStorage("discharge", "true");
  3853. if (eggstra.canArm) fireEvent(eggstra.link, 'click');
  3854. }
  3855. else if (charge < 20 && charge > stopDischargeAt) {
  3856. if (isDischarge) {
  3857. if (eggstra.canArm) fireEvent(eggstra.link, 'click');
  3858. }
  3859. else {
  3860. if (charge >= chargeHigh) {
  3861. if (eggstraCharge.quantity > 0){
  3862. if (!eggstraCharge.isArmed) fireEvent(eggstraCharge.link, 'click');
  3863. }
  3864. else{
  3865. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3866. }
  3867. }
  3868. else {
  3869. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3870. }
  3871. }
  3872. }
  3873. else if (charge <= stopDischargeAt) {
  3874. if (charge >= chargeHigh) {
  3875. if (eggstraCharge.quantity > 0){
  3876. if (!eggstraCharge.isArmed) fireEvent(eggstraCharge.link, 'click');
  3877. }
  3878. else{
  3879. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3880. }
  3881. }
  3882. else {
  3883. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3884. }
  3885. setStorage("discharge", "false");
  3886. }
  3887. }
  3888. catch (e) {
  3889. console.perror('checkCharge2016',e.message);
  3890. }
  3891. }
  3892. function checkCharge(stopDischargeAt) {
  3893. try {
  3894. var charge = parseInt(document.getElementsByClassName("chargeQuantity")[0].innerText);
  3895. console.plog('Current Charge:', charge);
  3896. if (charge == 20) {
  3897. setStorage("discharge", true.toString());
  3898. checkThenArm(null, "trinket", "Eggstra Charm");
  3899. }
  3900.  
  3901. else if (charge < 20 && charge > stopDischargeAt) {
  3902. if (getStorage("discharge") == "true") {
  3903. checkThenArm(null, "trinket", "Eggstra Charm");
  3904. }
  3905. else {
  3906. if (stopDischargeAt == 17) {
  3907. checkThenArm('best', "trinket", chargeCharm);
  3908. }
  3909. else {
  3910. checkThenArm(null, "trinket", "Eggscavator");
  3911. }
  3912. }
  3913. }
  3914. else if (charge == stopDischargeAt) {
  3915. if (stopDischargeAt == 17) {
  3916. checkThenArm('best', "trinket", chargeCharm);
  3917. }
  3918. else {
  3919. checkThenArm(null, "trinket", "Eggscavator");
  3920. }
  3921. setStorage("discharge", false.toString());
  3922. }
  3923. else if (charge < stopDischargeAt) {
  3924. setStorage("discharge", false.toString());
  3925. checkThenArm(null, "trinket", "Eggscavator");
  3926. }
  3927. return;
  3928. }
  3929. catch (e) {
  3930. console.perror('checkCharge',e.message);
  3931. }
  3932. }
  3933.  
  3934. function checkThenArm(sort, category, name, isForcedRetry) //category = weapon/base/charm/trinket/bait
  3935. {
  3936. if(isNullOrUndefined(name) || name === '')
  3937. return;
  3938.  
  3939. if (category == "charm")
  3940. category = "trinket";
  3941.  
  3942. if(!(Array.isArray(name))){
  3943. var obj = getConstToRealValue(sort, category, name);
  3944. if(obj.changed){
  3945. sort = obj.sort;
  3946. name = obj.name;
  3947. }
  3948. }
  3949.  
  3950. if(Array.isArray(name)){
  3951. if(!(sort == 'best' || sort == 'any'))
  3952. sort = 'best';
  3953. if(name.length == 1){
  3954. sort = null;
  3955. name = name[0];
  3956. }
  3957. }
  3958. else{
  3959. if(name.toUpperCase().indexOf('NONE') === 0){
  3960. disarmTrap(category);
  3961. return;
  3962. }
  3963. sort = null;
  3964. }
  3965.  
  3966. if(isNullOrUndefined(isForcedRetry))
  3967. isForcedRetry = true;
  3968.  
  3969. var trapArmed = undefined;
  3970. var userVariable = getPageVariable("user." + category + "_name");
  3971. if (sort == 'best') {
  3972. getTrapList(category);
  3973. if (objTrapList[category].length === 0){
  3974. var intervalCTA1 = setInterval(
  3975. function (){
  3976. if (!arming){
  3977. getTrapListFromTrapSelector(sort, category, name, isForcedRetry);
  3978. clearInterval(intervalCTA1);
  3979. intervalCTA1 = null;
  3980. return;
  3981. }
  3982. }, 1000);
  3983. return;
  3984. }
  3985. else{
  3986. var nIndex = -1;
  3987. for (var i = 0; i < name.length; i++) {
  3988. for (var j = 0; j < objTrapList[category].length; j++) {
  3989. nIndex = objTrapList[category][j].indexOf("...");
  3990. if(nIndex > -1)
  3991. name[i] = name[i].substr(0,nIndex);
  3992. if (objTrapList[category][j].indexOf(name[i]) === 0){
  3993. console.plog('Best', category, 'found:', name[i], 'Currently Armed:', userVariable);
  3994. if (userVariable.indexOf(name[i]) === 0) {
  3995. trapArmed = true;
  3996. arming = false;
  3997. closeTrapSelector(category);
  3998. return;
  3999. }
  4000. else {
  4001. trapArmed = false;
  4002. break;
  4003. }
  4004. }
  4005. }
  4006. if (trapArmed === false)
  4007. break;
  4008. }
  4009. }
  4010. }
  4011. else if(sort == 'any'){
  4012. trapArmed = false;
  4013. for (var i = 0; i < name.length; i++){
  4014. if (userVariable.indexOf(name[i]) === 0){
  4015. trapArmed = true;
  4016. break;
  4017. }
  4018. }
  4019. }
  4020. else{
  4021. trapArmed = (userVariable.indexOf(name) === 0);
  4022. }
  4023.  
  4024. if (trapArmed === undefined && isForcedRetry){
  4025. console.plog(name.join("/"), "not found in TrapList" + capitalizeFirstLetter(category));
  4026. clearTrapList(category);
  4027. checkThenArm(sort, category, name, false);
  4028. }
  4029. else if (trapArmed === false){
  4030. addArmingIntoList(category);
  4031. var intervalCTA = setInterval(
  4032. function (){
  4033. if (arming === false){
  4034. clickThenArmTrapInterval(sort, category, name);
  4035. clearInterval(intervalCTA);
  4036. intervalCTA = null;
  4037. return;
  4038. }
  4039. }, 1000);
  4040. }
  4041. }
  4042.  
  4043. function getConstToRealValue(sort, category, name){
  4044. var objRet = {
  4045. changed : false,
  4046. sort : sort,
  4047. name : name
  4048. };
  4049. if(g_objConstTrap.hasOwnProperty(category)){
  4050. var arrKeys = Object.keys(g_objConstTrap[category]);
  4051. var nIndex = arrKeys.indexOf(name);
  4052. if(nIndex > -1){
  4053. var keyName = arrKeys[nIndex];
  4054. objRet.sort = g_objConstTrap[category][keyName].sort;
  4055. objRet.name = g_objConstTrap[category][keyName].name.slice();
  4056. objRet.changed = true;
  4057. }
  4058. }
  4059. return objRet;
  4060. }
  4061.  
  4062. function addArmingIntoList(category){
  4063. g_arrArmingList.push(category);
  4064. }
  4065.  
  4066. function deleteArmingFromList(category){
  4067. var nIndex = g_arrArmingList.indexOf(category);
  4068. if(nIndex > -1)
  4069. g_arrArmingList.splice(nIndex, 1);
  4070. }
  4071.  
  4072. function isArmingInList(){
  4073. return (g_arrArmingList.length > 0);
  4074. }
  4075.  
  4076. function clickThenArmTrapInterval(sort, trap, name){ //sort = power/luck/attraction
  4077. clickTrapSelector(trap);
  4078. var sec = secWait;
  4079. var armStatus = LOADING;
  4080. var retry = armTrapRetry;
  4081. var intervalCTATI = setInterval(
  4082. function (){
  4083. armStatus = armTrap(sort, trap, name);
  4084. if (armStatus != LOADING){
  4085. deleteArmingFromList(trap);
  4086. if(isNewUI && !isArmingInList())
  4087. closeTrapSelector(trap);
  4088. clearInterval(intervalCTATI);
  4089. arming = false;
  4090. intervalCTATI = null;
  4091. if (armStatus == NOT_FOUND){
  4092. //clearTrapList(trap);
  4093. if (trap == 'trinket')
  4094. disarmTrap('trinket');
  4095. else
  4096. closeTrapSelector(trap);
  4097. }
  4098. return;
  4099. }
  4100. else{
  4101. --sec;
  4102. if (sec <= 0){
  4103. if(isNewUI)
  4104. closeTrapSelector(trap);
  4105. clickTrapSelector(trap, true);
  4106. sec = secWait;
  4107. --retry;
  4108. if (retry <= 0){
  4109. deleteArmingFromList(trap);
  4110. if(isNewUI && !isArmingInList())
  4111. closeTrapSelector(trap);
  4112. clearInterval(intervalCTATI);
  4113. arming = false;
  4114. intervalCTATI = null;
  4115. return;
  4116. }
  4117. }
  4118. }
  4119. }, 1000);
  4120. return;
  4121. }
  4122.  
  4123. // name = Brie/Gouda/Swiss (brie = wrong)
  4124. function armTrap(sort, trap, name) {
  4125. return (isNewUI) ? armTrapNewUI(sort, trap, name) : armTrapClassicUI(sort, trap, name);
  4126. }
  4127.  
  4128. function armTrapClassicUI(sort, trap, name){
  4129. var tagGroupElement = document.getElementsByClassName('tagGroup');
  4130. var tagElement;
  4131. var nameElement;
  4132. var nIndex = -1;
  4133. var arrName = (Array.isArray(name)) ? name.slice() : [name];
  4134.  
  4135. if (sort == 'best' || sort == 'any')
  4136. name = name[0];
  4137.  
  4138. if (tagGroupElement.length > 0){
  4139. console.plog('Try to arm', name);
  4140. for (var i = 0; i < tagGroupElement.length; ++i){
  4141. tagElement = tagGroupElement[i].getElementsByTagName('a');
  4142. for (var j = 0; j < tagElement.length; ++j){
  4143. nameElement = tagElement[j].getElementsByClassName('name')[0].innerText;
  4144. nIndex = nameElement.indexOf("...");
  4145. if(nIndex > -1)
  4146. name = name.substr(0, nIndex);
  4147. if (nameElement.indexOf(name) === 0){
  4148. if(tagElement[j].getAttribute('class').indexOf('selected')<0) // only click when not arming
  4149. fireEvent(tagElement[j], 'click');
  4150. else
  4151. closeTrapSelector(trap);
  4152.  
  4153. if(objTrapList[trap].indexOf(nameElement) < 0){
  4154. objTrapList[trap].unshift(nameElement);
  4155. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4156. }
  4157. console.plog(name, 'armed');
  4158. return ARMED;
  4159. }
  4160. }
  4161. }
  4162. console.plog(name, 'not found');
  4163. for(var i=0;i<objTrapList[trap].length;i++){
  4164. if(objTrapList[trap][i].indexOf(name) === 0){
  4165. objTrapList[trap].splice(i,1);
  4166. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4167. break;
  4168. }
  4169. }
  4170. if (sort == 'best' || sort == 'any'){
  4171. arrName.shift();
  4172. if (arrName.length > 0)
  4173. return armTrapClassicUI(sort, trap, arrName);
  4174. else
  4175. return NOT_FOUND;
  4176. }
  4177. else
  4178. return NOT_FOUND;
  4179. }
  4180. else
  4181. return LOADING;
  4182. }
  4183.  
  4184. function armTrapNewUI(sort, trap, name){
  4185. var itemEle = document.getElementsByClassName('campPage-trap-itemBrowser-item');
  4186. var nameElement;
  4187. var arrName = (Array.isArray(name)) ? name.slice() : [name];
  4188.  
  4189. if (sort == 'best' || sort == 'any')
  4190. name = name[0];
  4191.  
  4192. if (itemEle.length > 0) {
  4193. console.plog('Trying to arm ' + name);
  4194. for (var i = 0; i < itemEle.length; i++) {
  4195. nameElement = itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-name')[0].textContent;
  4196. if (nameElement.indexOf(name) === 0) {
  4197. if(itemEle[i].getAttribute('class').indexOf('canArm') > -1)
  4198. fireEvent(itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-armButton')[0], 'click');
  4199. else
  4200. closeTrapSelector(trap);
  4201. if(objTrapList[trap].indexOf(nameElement) < 0){
  4202. objTrapList[trap].unshift(nameElement);
  4203. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4204. }
  4205. console.plog(name + ' armed');
  4206. return ARMED;
  4207. }
  4208. }
  4209.  
  4210. console.plog(name, 'not found');
  4211. for(var i=0;i<objTrapList[trap].length;i++){
  4212. if(objTrapList[trap][i].indexOf(name) === 0){
  4213. objTrapList[trap].splice(i,1);
  4214. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4215. break;
  4216. }
  4217. }
  4218. if (sort == 'best' || sort == 'any'){
  4219. arrName.shift();
  4220. if (arrName.length > 0)
  4221. return armTrapNewUI(sort, trap, arrName);
  4222. else
  4223. return NOT_FOUND;
  4224. }
  4225. else
  4226. return NOT_FOUND;
  4227. }
  4228. else
  4229. return LOADING;
  4230. }
  4231.  
  4232. function clickTrapSelector(strSelect, bForceClick){ //strSelect = weapon/base/charm/trinket/bait
  4233. if(isNullOrUndefined(bForceClick))
  4234. bForceClick = false;
  4235. if(isNewUI){
  4236. var armedItem = document.getElementsByClassName('campPage-trap-armedItem ' + strSelect)[0];
  4237. var arrTemp = armedItem.getAttribute('class').split(" ");
  4238. if(bForceClick !== true && arrTemp[arrTemp.length-1] == 'active'){ // trap selector opened
  4239. arming = true;
  4240. return (console.plog('Trap selector', strSelect, 'opened'));
  4241. }
  4242. fireEvent(armedItem, 'click');
  4243. }
  4244. else{
  4245. if(bForceClick !== true && document.getElementsByClassName("showComponents " + strSelect).length > 0){ // trap selector opened
  4246. arming = true;
  4247. return (console.plog('Trap selector', strSelect, 'opened'));
  4248. }
  4249. if (strSelect == "base")
  4250. fireEvent(document.getElementsByClassName('trapControlThumb')[0], 'click');
  4251. else if (strSelect == "weapon")
  4252. fireEvent(document.getElementsByClassName('trapControlThumb')[1], 'click');
  4253. else if (strSelect == "charm" || strSelect == "trinket")
  4254. fireEvent(document.getElementsByClassName('trapControlThumb')[2], 'click');
  4255. else if (strSelect == "bait")
  4256. fireEvent(document.getElementsByClassName('trapControlThumb')[3], 'click');
  4257. else
  4258. return (console.plog("Invalid trapSelector"));
  4259. }
  4260. arming = true;
  4261. console.plog("Trap selector", strSelect, "clicked");
  4262. }
  4263.  
  4264. function closeTrapSelector(category){
  4265. if(isNewUI){
  4266. var armedItem = document.getElementsByClassName('campPage-trap-armedItem ' + category)[0];
  4267. if(!isNullOrUndefined(armedItem) && armedItem.getAttribute('class').indexOf('active') > -1){ // trap selector opened
  4268. fireEvent(armedItem, 'click');
  4269. console.plog("Trap selector", category, "closed");
  4270. }
  4271. }
  4272. else{
  4273. if(document.getElementsByClassName("showComponents " + category).length > 0){
  4274. fireEvent(document.getElementById('trapSelectorBrowserClose'), 'click');
  4275. console.plog("Trap selector", category, "closed");
  4276. }
  4277. }
  4278. }
  4279.  
  4280. function retrieveDataFirst() {
  4281. try {
  4282. var gotHornTime = false;
  4283. var gotPuzzle = false;
  4284. var gotBaitQuantity = false;
  4285. var retrieveSuccess = false;
  4286.  
  4287. var scriptElementList = document.getElementsByTagName('script');
  4288.  
  4289. if (scriptElementList) {
  4290. var i;
  4291. for (i = 0; i < scriptElementList.length; ++i) {
  4292. var scriptString = scriptElementList[i].innerHTML;
  4293.  
  4294. // get next horn time
  4295. var hornTimeStartIndex = scriptString.indexOf("next_activeturn_seconds");
  4296. if (hornTimeStartIndex >= 0) {
  4297. hornTimeStartIndex += 25;
  4298. var hornTimeEndIndex = scriptString.indexOf(",", hornTimeStartIndex);
  4299. var hornTimerString = scriptString.substring(hornTimeStartIndex, hornTimeEndIndex);
  4300. nextActiveTime = parseInt(hornTimerString);
  4301.  
  4302. hornTimeDelay = hornTimeDelayMin + Math.round(Math.random() * (hornTimeDelayMax - hornTimeDelayMin));
  4303. //console.plog('Horn Time:', nextActiveTime, 'Delay:', hornTimeDelay);
  4304. if (!aggressiveMode) {
  4305. // calculation base on the js in Mousehunt
  4306. var additionalDelayTime = Math.ceil(nextActiveTime * 0.1);
  4307.  
  4308. // need to found out the mousehunt provided timer interval to determine the additional delay
  4309. var timerIntervalStartIndex = scriptString.indexOf("hud.timer_interval");
  4310. if (timerIntervalStartIndex >= 0) {
  4311. timerIntervalStartIndex += 21;
  4312. var timerIntervalEndIndex = scriptString.indexOf(";", timerIntervalStartIndex);
  4313. var timerIntervalString = scriptString.substring(timerIntervalStartIndex, timerIntervalEndIndex);
  4314. var timerInterval = parseInt(timerIntervalString);
  4315.  
  4316. // calculation base on the js in Mousehunt
  4317. if (timerInterval == 1) {
  4318. additionalDelayTime = 2;
  4319. }
  4320.  
  4321. timerIntervalStartIndex = undefined;
  4322. timerIntervalEndIndex = undefined;
  4323. timerIntervalString = undefined;
  4324. timerInterval = undefined;
  4325. }
  4326.  
  4327. // safety mode, include extra delay like time in horn image appear
  4328. //hornTime = nextActiveTime + additionalDelayTime + hornTimeDelay;
  4329. hornTime = nextActiveTime + hornTimeDelay;
  4330. lastDateRecorded = undefined;
  4331. lastDateRecorded = new Date();
  4332.  
  4333. additionalDelayTime = undefined;
  4334. }
  4335. else {
  4336. // aggressive mode, no extra delay like time in horn image appear
  4337. hornTime = nextActiveTime;
  4338. lastDateRecorded = undefined;
  4339. lastDateRecorded = new Date();
  4340. }
  4341.  
  4342. gotHornTime = true;
  4343.  
  4344. hornTimeStartIndex = undefined;
  4345. hornTimeEndIndex = undefined;
  4346. hornTimerString = undefined;
  4347. }
  4348.  
  4349. // get is king's reward or not
  4350. var hasPuzzleStartIndex = scriptString.indexOf("has_puzzle");
  4351. if (hasPuzzleStartIndex >= 0) {
  4352. hasPuzzleStartIndex += 12;
  4353. var hasPuzzleEndIndex = scriptString.indexOf(",", hasPuzzleStartIndex);
  4354. var hasPuzzleString = scriptString.substring(hasPuzzleStartIndex, hasPuzzleEndIndex);
  4355. console.plog('hasPuzzleString:', hasPuzzleString);
  4356. isKingReward = (hasPuzzleString != 'false');
  4357.  
  4358. gotPuzzle = true;
  4359.  
  4360. hasPuzzleStartIndex = undefined;
  4361. hasPuzzleEndIndex = undefined;
  4362. hasPuzzleString = undefined;
  4363. }
  4364.  
  4365. // get cheese quantity
  4366. var baitQuantityStartIndex = scriptString.indexOf("bait_quantity");
  4367. if (baitQuantityStartIndex >= 0) {
  4368. baitQuantityStartIndex += 15;
  4369. var baitQuantityEndIndex = scriptString.indexOf(",", baitQuantityStartIndex);
  4370. var baitQuantityString = scriptString.substring(baitQuantityStartIndex, baitQuantityEndIndex);
  4371. g_nBaitQuantity = parseInt(baitQuantityString);
  4372.  
  4373. gotBaitQuantity = true;
  4374.  
  4375. baitQuantityStartIndex = undefined;
  4376. baitQuantityEndIndex = undefined;
  4377. baitQuantityString = undefined;
  4378. }
  4379.  
  4380. var locationStartIndex;
  4381. var locationEndIndex;
  4382. locationStartIndex = scriptString.indexOf("location\":\"");
  4383. if (locationStartIndex >= 0) {
  4384. locationStartIndex += 11;
  4385. locationEndIndex = scriptString.indexOf("\"", locationStartIndex);
  4386. var locationString = scriptString.substring(locationStartIndex, locationEndIndex);
  4387. currentLocation = locationString;
  4388.  
  4389. locationStartIndex = undefined;
  4390. locationEndIndex = undefined;
  4391. locationString = undefined;
  4392. }
  4393.  
  4394. scriptString = undefined;
  4395. }
  4396. i = undefined;
  4397. }
  4398. scriptElementList = undefined;
  4399.  
  4400. if (gotHornTime && gotPuzzle && gotBaitQuantity) {
  4401. // get trap check time
  4402. CalculateNextTrapCheckInMinute();
  4403.  
  4404. // get last location
  4405. var huntLocationCookie = getStorage("huntLocation");
  4406. if (isNullOrUndefined(huntLocationCookie)) {
  4407. huntLocation = currentLocation;
  4408. setStorage("huntLocation", currentLocation);
  4409. }
  4410. else {
  4411. huntLocation = huntLocationCookie;
  4412. setStorage("huntLocation", huntLocation);
  4413. }
  4414. huntLocationCookie = undefined;
  4415.  
  4416. // get last king reward time
  4417. var lastKingRewardDate = getStorage("lastKingRewardDate");
  4418. if (isNullOrUndefined(lastKingRewardDate)) {
  4419. lastKingRewardSumTime = -1;
  4420. }
  4421. else {
  4422. var lastDate = new Date(lastKingRewardDate);
  4423. lastKingRewardSumTime = parseInt((new Date() - lastDate) / 1000);
  4424. lastDate = undefined;
  4425. }
  4426. lastKingRewardDate = undefined;
  4427.  
  4428. retrieveSuccess = true;
  4429. }
  4430. else {
  4431. retrieveSuccess = false;
  4432. }
  4433.  
  4434. // clean up
  4435. gotHornTime = undefined;
  4436. gotPuzzle = undefined;
  4437. gotBaitQuantity = undefined;
  4438. return (retrieveSuccess);
  4439. }
  4440. catch (e) {
  4441. console.perror('retrieveDataFirst',e.message);
  4442. }
  4443. }
  4444.  
  4445. function GetHornTime() {
  4446. var huntTimerElement = document.getElementById('huntTimer');
  4447. var totalSec = 900;
  4448. if (huntTimerElement !== null) {
  4449. huntTimerElement = huntTimerElement.textContent;
  4450. if(huntTimerElement.toLowerCase().indexOf('ready') > -1)
  4451. totalSec = 0;
  4452. else if (isNewUI) {
  4453. var arrTime = huntTimerElement.split(":");
  4454. if(arrTime.length == 2){
  4455. for(var i=0;i<arrTime.length;i++)
  4456. arrTime[i] = parseInt(arrTime[i]);
  4457. totalSec = arrTime[0] * 60 + arrTime[1];
  4458. }
  4459. }
  4460. else {
  4461. var temp = parseInt(huntTimerElement);
  4462. if(Number.isInteger(temp))
  4463. totalSec = temp * 60;
  4464. }
  4465. }
  4466. return totalSec;
  4467. }
  4468.  
  4469. function getKingRewardStatus() {
  4470. var strValue = getPageVariable('user.has_puzzle');
  4471. console.plog('user.has_puzzle:', strValue);
  4472. return (strValue == 'true');
  4473. var headerOrHud = (isNewUI) ? document.getElementById('mousehuntHud') : document.getElementById('header');
  4474. if (headerOrHud !== null) {
  4475. var textContentLowerCase = headerOrHud.textContent.toLowerCase();
  4476. if (textContentLowerCase.indexOf("king reward") > -1 ||
  4477. textContentLowerCase.indexOf("king's reward") > -1 ||
  4478. textContentLowerCase.indexOf("kings reward") > -1) {
  4479. return true;
  4480. }
  4481. else
  4482. return (strValue == 'true');
  4483. }
  4484. else
  4485. return false;
  4486. }
  4487.  
  4488. function getBaitQuantity() {
  4489. var hudBaitQuantity = document.getElementById('hud_baitQuantity');
  4490. if (hudBaitQuantity !== null) {
  4491. return parseInt(hudBaitQuantity.textContent);
  4492. }
  4493. else {
  4494. return 0;
  4495. }
  4496. }
  4497.  
  4498. function getCurrentLocation() {
  4499. var tempLocation;
  4500. if (isNewUI) {
  4501. tempLocation = document.getElementsByClassName('mousehuntHud-environmentName');
  4502. if (tempLocation.length > 0)
  4503. return tempLocation[0].textContent;
  4504. else
  4505. return "";
  4506. }
  4507. else {
  4508. tempLocation = document.getElementById('hud_location');
  4509. if (!isNullOrUndefined(tempLocation))
  4510. return tempLocation.textContent;
  4511. else
  4512. return "";
  4513. }
  4514. }
  4515.  
  4516. function retrieveData() {
  4517. try {
  4518. // get next horn time
  4519. currentLocation = getCurrentLocation();
  4520. isKingReward = getKingRewardStatus();
  4521. g_nBaitQuantity = getBaitQuantity();
  4522. nextActiveTime = GetHornTime();
  4523. if (nextActiveTime === "" || isNaN(nextActiveTime)) {
  4524. // fail to retrieve data, might be due to slow network
  4525.  
  4526. // reload the page to see it fix the problem
  4527. window.setTimeout(function () { reloadWithMessage("Fail to retrieve data. Reloading...", false); }, 5000);
  4528. }
  4529. else {
  4530. // got the timer right!
  4531. if(nextActiveTime === 0)
  4532. hornTimeDelay = 0;
  4533. else{
  4534. // calculate the delay
  4535. hornTimeDelay = hornTimeDelayMin + Math.round(Math.random() * (hornTimeDelayMax - hornTimeDelayMin));
  4536. }
  4537. console.plog('Horn Time:', nextActiveTime, 'Delay:', hornTimeDelay);
  4538. if (!aggressiveMode) {
  4539. // safety mode, include extra delay like time in horn image appear
  4540. hornTime = nextActiveTime + hornTimeDelay;
  4541. }
  4542. else {
  4543. // aggressive mode, no extra delay like time in horn image appear
  4544. hornTime = nextActiveTime;
  4545. }
  4546. lastDateRecorded = new Date();
  4547. }
  4548.  
  4549. // get trap check time
  4550. CalculateNextTrapCheckInMinute();
  4551. getJournalDetail();
  4552. eventLocationCheck('retrieveData()');
  4553. specialFeature('retrieveData()');
  4554. mapHunting();
  4555. }
  4556. catch (e) {
  4557. console.perror('retrieveData',e.message);
  4558. }
  4559. }
  4560.  
  4561. function checkJournalDate() {
  4562. var reload = false;
  4563.  
  4564. var journalDateDiv = document.getElementsByClassName('journaldate');
  4565. if (journalDateDiv) {
  4566. var journalDateStr = journalDateDiv[0].innerHTML.toString();
  4567. var midIndex = journalDateStr.indexOf(":", 0);
  4568. var spaceIndex = journalDateStr.indexOf(" ", midIndex);
  4569.  
  4570. if (midIndex >= 1) {
  4571. var hrStr = journalDateStr.substring(0, midIndex);
  4572. var minStr = journalDateStr.substr(midIndex + 1, 2);
  4573. var hourSysStr = journalDateStr.substr(spaceIndex + 1, 2);
  4574.  
  4575. var nowDate = new Date();
  4576. var lastHuntDate = new Date();
  4577. if (hourSysStr == "am") {
  4578. lastHuntDate.setHours(parseInt(hrStr), parseInt(minStr), 0, 0);
  4579. }
  4580. else {
  4581. lastHuntDate.setHours(parseInt(hrStr) + 12, parseInt(minStr), 0, 0);
  4582. }
  4583. if (parseInt(nowDate - lastHuntDate) / 1000 > 900) {
  4584. reload = true;
  4585. }
  4586. hrStr = undefined;
  4587. minStr = undefined;
  4588. nowDate = undefined;
  4589. lastHuntDate = undefined;
  4590. }
  4591. else {
  4592. reload = true;
  4593. }
  4594.  
  4595. journalDateStr = undefined;
  4596. midIndex = undefined;
  4597. spaceIndex = undefined;
  4598. }
  4599. journalDateDiv = undefined;
  4600.  
  4601. if (reload) {
  4602. reloadWithMessage("Timer error. Try reload to fix.", true);
  4603. }
  4604.  
  4605. try {
  4606. return (reload);
  4607. }
  4608. finally {
  4609. reload = undefined;
  4610. }
  4611. }
  4612.  
  4613. function action() {
  4614. if (isKingReward) {
  4615. kingRewardAction();
  4616. }
  4617. else if (pauseAtInvalidLocation && (huntLocation != currentLocation)) {
  4618. // update timer
  4619. displayTimer("Out of pre-defined hunting location...", "Out of pre-defined hunting location...", "Out of pre-defined hunting location...");
  4620. if (fbPlatform)
  4621. 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>");
  4622. else if (hiFivePlatform)
  4623. 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>");
  4624. else if (mhPlatform)
  4625. 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>");
  4626. displayKingRewardSumTime(null);
  4627. // pause script
  4628. }
  4629. else if (g_nBaitQuantity === 0) {
  4630. // update timer
  4631. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4632. displayLocation(huntLocation);
  4633. displayKingRewardSumTime(null);
  4634.  
  4635. // pause the script
  4636. }
  4637. else {
  4638. // update location
  4639. displayLocation(huntLocation);
  4640.  
  4641. var isHornSounding = false;
  4642.  
  4643. // check if the horn image is visible
  4644. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('header');
  4645. if (headerElement) {
  4646. var headerStatus = headerElement.getAttribute('class');
  4647. headerStatus = headerStatus.toLowerCase();
  4648. if (headerStatus.indexOf("hornready") != -1) {
  4649. // if the horn image is visible, why do we need to wait any more, sound the horn!
  4650. soundHorn();
  4651.  
  4652. // make sure the timer don't run twice!
  4653. isHornSounding = true;
  4654. }
  4655. headerStatus = undefined;
  4656. }
  4657. headerElement = undefined;
  4658.  
  4659. if (isHornSounding === false) {
  4660. // start timer
  4661. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  4662. }
  4663.  
  4664. isHornSounding = undefined;
  4665. try{
  4666. getJournalDetail();
  4667. eventLocationCheck('action()');
  4668. specialFeature('action()');
  4669. mapHunting();
  4670. }
  4671. catch (e){
  4672. console.perror('action:',e.message);
  4673. }
  4674. }
  4675. }
  4676.  
  4677. function countdownTimer() {
  4678. try {
  4679. if (isKingReward) {
  4680. // update timer
  4681. displayTimer("King's Reward!", "King's Reward!", "King's Reward!");
  4682. displayKingRewardSumTime("Now");
  4683. lastKingRewardSumTime = 0;
  4684. if(isNewUI){
  4685. reloadPage(false);
  4686. }
  4687. else{
  4688. // reload the page so that the sound can be play
  4689. // simulate mouse click on the camp button
  4690. fireEvent(document.getElementsByClassName(strCampButton)[0].firstChild, 'click');
  4691. }
  4692.  
  4693. // reload the page if click on the camp button fail
  4694. window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  4695. }
  4696. else if (pauseAtInvalidLocation && (huntLocation != currentLocation)) {
  4697. // update timer
  4698. displayTimer("Out of pre-defined hunting location...", "Out of pre-defined hunting location...", "Out of pre-defined hunting location...");
  4699. if (fbPlatform)
  4700. 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>");
  4701. else if (hiFivePlatform)
  4702. 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>");
  4703. else if (mhPlatform)
  4704. 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>");
  4705. displayKingRewardSumTime(null);
  4706.  
  4707. // pause script
  4708. }
  4709. else {
  4710. var dateNow = new Date();
  4711. var intervalTime = timeElapsed(lastDateRecorded, dateNow);
  4712. lastDateRecorded = undefined;
  4713. lastDateRecorded = dateNow;
  4714. dateNow = undefined;
  4715.  
  4716. if (enableTrapCheck) checkTime -= intervalTime;
  4717.  
  4718. // update time
  4719. hornTime -= intervalTime;
  4720. if (lastKingRewardSumTime != -1) {
  4721. lastKingRewardSumTime += intervalTime;
  4722. }
  4723.  
  4724. intervalTime = undefined;
  4725.  
  4726. if (hornTime <= 0) {
  4727. // blow the horn!
  4728. hornTime = 0;
  4729. if(getBaitQuantity() > 0)
  4730. soundHorn();
  4731. else{
  4732. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4733. displayLocation(huntLocation);
  4734. displayKingRewardSumTime(null);
  4735. }
  4736. }
  4737. else if (enableTrapCheck && checkTime <= 0) {
  4738. // trap check!
  4739. if(getBaitQuantity() > 0)
  4740. trapCheck();
  4741. else{
  4742. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4743. displayLocation(huntLocation);
  4744. displayKingRewardSumTime(null);
  4745. }
  4746. }
  4747. else {
  4748. if (enableTrapCheck) {
  4749. // update timer
  4750. if (!aggressiveMode) {
  4751. displayTimer("Horn: " + timeFormat(hornTime) + " | Check: " + timeFormat(checkTime),
  4752. timeFormat(hornTime) + " <i>(included extra " + timeFormat(hornTimeDelay) + " delay & +/- 5 seconds different from MouseHunt timer)</i>",
  4753. timeFormat(checkTime) + " <i>(included extra " + timeFormat(checkTimeDelay) + " delay)</i>");
  4754. }
  4755. else {
  4756. displayTimer("Horn: " + timeFormat(hornTime) + " | Check: " + timeFormat(checkTime),
  4757. timeFormat(hornTime) + " <i>(lot faster than MouseHunt timer)</i>",
  4758. timeFormat(checkTime) + " <i>(included extra " + timeFormat(checkTimeDelay) + " delay)</i>");
  4759. }
  4760. }
  4761. else {
  4762. // update timer
  4763. if (!aggressiveMode) {
  4764. displayTimer("Horn: " + timeFormat(hornTime),
  4765. timeFormat(hornTime) + " <i>(included extra " + timeFormat(hornTimeDelay) + " delay & +/- 5 seconds different from MouseHunt timer)</i>",
  4766. "-");
  4767.  
  4768. // check if user manaually sounded the horn
  4769. var scriptNode = document.getElementById("scriptNode");
  4770. if (scriptNode) {
  4771. var isHornSounded = scriptNode.getAttribute("soundedHornAtt");
  4772. if (isHornSounded == "true") {
  4773. // sound horn function do the rest
  4774. soundHorn();
  4775.  
  4776. // stop loopping
  4777. return;
  4778. }
  4779. isHornSounded = undefined;
  4780. }
  4781. scriptNode = undefined;
  4782. }
  4783. else {
  4784. displayTimer("Horn: " + timeFormat(hornTime),
  4785. timeFormat(hornTime) + " <i>(lot faster than MouseHunt timer)</i>",
  4786. "-");
  4787.  
  4788. // agressive mode should sound the horn whenever it is possible to do so.
  4789. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('header');
  4790. if (headerElement) {
  4791. var headerStatus = headerElement.getAttribute('class');
  4792. headerStatus = headerStatus.toLowerCase();
  4793. // the horn image appear before the timer end
  4794. if (headerStatus.indexOf("hornready") != -1) {
  4795. // who care, blow the horn first!
  4796. soundHorn();
  4797.  
  4798. headerElement = undefined;
  4799.  
  4800. // skip all the code below
  4801. return;
  4802. }
  4803. }
  4804. headerElement = undefined;
  4805. }
  4806. }
  4807.  
  4808. // set king reward sum time
  4809. displayKingRewardSumTime(timeFormatLong(lastKingRewardSumTime));
  4810.  
  4811. window.setTimeout(function () { (countdownTimer)(); }, timerRefreshInterval * 1000);
  4812. }
  4813. }
  4814. }
  4815. catch (e) {
  4816. console.perror('countdownTimer',e.message);
  4817. }
  4818. }
  4819.  
  4820. function reloadPage(soundHorn) {
  4821. // reload the page
  4822. var strTurn = (soundHorn) ? "turn.php" : "";
  4823. if (fbPlatform) {
  4824. // for Facebook only
  4825. window.location.href = g_strHTTP + "://www.mousehuntgame.com/canvas/" + strTurn;
  4826. }
  4827. else if (hiFivePlatform) {
  4828. // for Hi5 only
  4829. window.location.href = g_strHTTP + "://mousehunt.hi5.hitgrab.com/" + strTurn;
  4830. }
  4831. else if (mhPlatform) {
  4832. // for mousehunt game only
  4833. window.location.href = g_strHTTP + "://www.mousehuntgame.com/" + strTurn;
  4834. }
  4835. }
  4836.  
  4837. function reloadWithMessage(msg, soundHorn) {
  4838. // display the message
  4839. displayTimer(msg, msg, msg, msg);
  4840.  
  4841. // reload the page
  4842. reloadPage(soundHorn);
  4843.  
  4844. msg = undefined;
  4845. soundHorn = undefined;
  4846. }
  4847.  
  4848. // ################################################################################################
  4849. // Timer Function - Start
  4850. // ################################################################################################
  4851.  
  4852. function embedTimer(targetPage) {
  4853. if (showTimerInPage) {
  4854. var headerElement;
  4855. if (fbPlatform || hiFivePlatform || mhPlatform)
  4856. headerElement = document.getElementById('noscript');
  4857. else if (mhMobilePlatform)
  4858. headerElement = document.getElementById('mobileHorn');
  4859.  
  4860. if (headerElement) {
  4861. var timerDivElement = document.createElement('div');
  4862.  
  4863. var hr1Element = document.createElement('hr');
  4864. timerDivElement.appendChild(hr1Element);
  4865. hr1Element = null;
  4866.  
  4867. // show bot title and version
  4868. var titleElement = document.createElement('div');
  4869. titleElement.setAttribute('id', 'titleElement');
  4870. if (targetPage && aggressiveMode)
  4871. 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>";
  4872. else if (targetPage && browser != 'chrome' && browser != 'opera')
  4873. 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>";
  4874. else
  4875. titleElement.innerHTML = "<a href=\"http://devcnn.wordpress.com\" target=\"_blank\"><b>MouseHunt AutoBot (version " + g_strVersion + " Enhanced Edition)</b></a>";
  4876. timerDivElement.appendChild(titleElement);
  4877. titleElement = null;
  4878.  
  4879. if (targetPage) {
  4880. nextHornTimeElement = document.createElement('div');
  4881. nextHornTimeElement.setAttribute('id', 'nextHornTimeElement');
  4882. nextHornTimeElement.innerHTML = "<b>Next Hunter Horn Time:</b> Loading...";
  4883. timerDivElement.appendChild(nextHornTimeElement);
  4884.  
  4885. checkTimeElement = document.createElement('div');
  4886. checkTimeElement.setAttribute('id', 'checkTimeElement');
  4887. checkTimeElement.innerHTML = "<b>Next Trap Check Time:</b> Loading...";
  4888. timerDivElement.appendChild(checkTimeElement);
  4889.  
  4890. if (pauseAtInvalidLocation) {
  4891. // location information only display when enable this feature
  4892. travelElement = document.createElement('div');
  4893. travelElement.setAttribute('id', 'travelElement');
  4894. travelElement.innerHTML = "<b>Target Hunt Location:</b> Loading...";
  4895. timerDivElement.appendChild(travelElement);
  4896. }
  4897.  
  4898. var lastKingRewardDate = getStorage("lastKingRewardDate");
  4899. var lastDateStr;
  4900. if (isNullOrUndefined(lastKingRewardDate)) {
  4901. lastDateStr = "-";
  4902. }
  4903. else {
  4904. var lastDate = new Date(lastKingRewardDate);
  4905. lastDateStr = lastDate.toDateString() + " " + lastDate.toTimeString().substring(0, 8);
  4906. lastDate = null;
  4907. }
  4908.  
  4909. kingTimeElement = document.createElement('div');
  4910. kingTimeElement.setAttribute('id', 'kingTimeElement');
  4911. kingTimeElement.innerHTML = "<b>Last King's Reward:</b> " + lastDateStr + " ";
  4912. timerDivElement.appendChild(kingTimeElement);
  4913.  
  4914. lastKingRewardSumTimeElement = document.createElement('font');
  4915. lastKingRewardSumTimeElement.setAttribute('id', 'lastKingRewardSumTimeElement');
  4916. lastKingRewardSumTimeElement.innerHTML = "(Loading...)";
  4917. kingTimeElement.appendChild(lastKingRewardSumTimeElement);
  4918.  
  4919. lastKingRewardDate = null;
  4920. lastDateStr = null;
  4921.  
  4922. if (showLastPageLoadTime) {
  4923. var nowDate = new Date();
  4924.  
  4925. // last page load time
  4926. var loadTimeElement = document.createElement('div');
  4927. loadTimeElement.setAttribute('id', 'loadTimeElement');
  4928. loadTimeElement.innerHTML = "<b>Last Page Load: </b>" + nowDate.toDateString() + " " + nowDate.toTimeString().substring(0, 8);
  4929. timerDivElement.appendChild(loadTimeElement);
  4930.  
  4931. loadTimeElement = null;
  4932. nowDate = null;
  4933. }
  4934. }
  4935. else {
  4936. // player currently navigating other page instead of hunter camp
  4937. var helpTextElement = document.createElement('div');
  4938. helpTextElement.setAttribute('id', 'helpTextElement');
  4939. if (fbPlatform)
  4940. 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.";
  4941. else if (hiFivePlatform)
  4942. 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.";
  4943. else if (mhPlatform)
  4944. 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.";
  4945. else if (mhMobilePlatform)
  4946. 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>.";
  4947. timerDivElement.appendChild(helpTextElement);
  4948.  
  4949. helpTextElement = null;
  4950. }
  4951.  
  4952. var showPreference = getStorage('showPreference');
  4953. if (isNullOrUndefined(showPreference)) {
  4954. showPreference = false;
  4955. setStorage("showPreference", showPreference);
  4956. }
  4957.  
  4958. var showPreferenceLinkDiv = document.createElement('div');
  4959. showPreferenceLinkDiv.setAttribute('id', 'showPreferenceLinkDiv');
  4960. showPreferenceLinkDiv.setAttribute('style', 'text-align:right');
  4961. timerDivElement.appendChild(showPreferenceLinkDiv);
  4962.  
  4963. var showPreferenceSpan = document.createElement('span');
  4964. var showPreferenceLinkStr = '<a id="showPreferenceLink" style="display:none" name="showPreferenceLink" onclick="\
  4965. if (document.getElementById(\'showPreferenceLink\').innerHTML == \'<b>[Hide Preference]</b>\'){\
  4966. document.getElementById(\'preferenceDiv\').style.display=\'none\';\
  4967. document.getElementById(\'showPreferenceLink\').innerHTML=\'<b>[Show Preference]</b>\';\
  4968. }\
  4969. else{\
  4970. setLocalToSession();\
  4971. var selectedAlgo = window.sessionStorage.getItem(\'eventLocation\');\
  4972. showOrHideTr(selectedAlgo);\
  4973. document.getElementById(\'preferenceDiv\').style.display=\'block\';\
  4974. document.getElementById(\'showPreferenceLink\').innerHTML=\'<b>[Hide Preference]</b>\';\
  4975. document.getElementById(\'eventAlgo\').value = selectedAlgo;\
  4976. initControlsBestTrap();\
  4977. }\
  4978. ">';
  4979. if (showPreference === true)
  4980. showPreferenceLinkStr += '<b>[Hide Preference]</b>';
  4981. else
  4982. showPreferenceLinkStr += '<b>[Show Preference]</b>';
  4983. showPreferenceLinkStr += '</a>';
  4984. showPreferenceLinkStr += '&nbsp;&nbsp;&nbsp;';
  4985.  
  4986. var restorePreferenceStr = '<input type="file" id="inputFiles" name="files" style="display:none;" onchange="handleFiles(this.files)"/>';
  4987. restorePreferenceStr += '<a id="idRestore" style="display:none" name="Restore" title="Click to restore preference" onclick="onIdRestoreClicked();">';
  4988. if(getSessionStorage('bRestart') != 'true')
  4989. restorePreferenceStr += '<b>[Restore]</b>';
  4990. else
  4991. restorePreferenceStr += '<b>Restart browser is required!</b>';
  4992. restorePreferenceStr += '</a>&nbsp;&nbsp;&nbsp;';
  4993. var getLogPreferenceStr = '<a id="idGetLogAndPreference" style="display:none" name="GetLogAndPreference" title="Click to get saved log & preference" onclick="onIdGetLogPreferenceClicked();">';
  4994. getLogPreferenceStr += '<b>[Get Log & Preference / Backup]</b></a>&nbsp;&nbsp;&nbsp;';
  4995. 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="\
  4996. window.localStorage.removeItem(\'TrapListWeapon\');\
  4997. window.localStorage.removeItem(\'TrapListBase\');\
  4998. window.localStorage.removeItem(\'TrapListTrinket\');\
  4999. window.localStorage.removeItem(\'TrapListBait\');\
  5000. window.localStorage.removeItem(\'LastRecordedJournal\');\
  5001. document.getElementById(\'clearTrapList\').getElementsByTagName(\'b\')[0].innerHTML = \'[Done!]\';\
  5002. window.setTimeout(function () { document.getElementById(\'clearTrapList\').getElementsByTagName(\'b\')[0].innerHTML = \'[Clear Trap List]\'; }, 1000);\
  5003. ">';
  5004. clearTrapListStr += '<b>[Clear Trap List]</b></a>&nbsp;&nbsp;&nbsp;';
  5005. showPreferenceSpan.innerHTML = restorePreferenceStr + getLogPreferenceStr + clearTrapListStr + showPreferenceLinkStr;
  5006. showPreferenceLinkDiv.appendChild(showPreferenceSpan);
  5007. showPreferenceLinkStr = null;
  5008. showPreferenceSpan = null;
  5009. showPreferenceLinkDiv = null;
  5010.  
  5011. var hr2Element = document.createElement('hr');
  5012. timerDivElement.appendChild(hr2Element);
  5013. hr2Element = null;
  5014.  
  5015. var temp = "";
  5016. var i;
  5017. var preferenceHTMLStr = '<table border="0" width="100%">';
  5018. preferenceHTMLStr += '<tr>';
  5019. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5020. 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;';
  5021. preferenceHTMLStr += '</td>';
  5022. preferenceHTMLStr += '<td style="height:24px">';
  5023. preferenceHTMLStr += '<select id="AggressiveModeInput" onchange="var isDisable = (value == \'true\') ? \'disabled\' : \'\'; document.getElementById(\'HornTimeDelayMinInput\').disabled=isDisable; document.getElementById(\'HornTimeDelayMaxInput\').disabled=isDisable;">';
  5024. if (aggressiveMode) {
  5025. preferenceHTMLStr += '<option value="false">False</option>';
  5026. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5027. temp = 'disabled';
  5028. }
  5029. else {
  5030. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5031. preferenceHTMLStr += '<option value="true">True</option>';
  5032. temp = '';
  5033. }
  5034. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time before sounding the horn (in seconds)"><b>Delay:</b></a>&emsp;';
  5035. preferenceHTMLStr += '<input type="number" id="HornTimeDelayMinInput" min="0" max="360" size="5" value="' + hornTimeDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5036. preferenceHTMLStr += '<input type="number" id="HornTimeDelayMaxInput" min="1" max="361" size="5" value="' + hornTimeDelayMax.toString() + '" ' + temp + '> seconds';
  5037. preferenceHTMLStr += '</td>';
  5038. preferenceHTMLStr += '</tr>';
  5039.  
  5040. preferenceHTMLStr += '<tr>';
  5041. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5042. preferenceHTMLStr += '<a title="Enable trap check once an hour"><b>Trap Check</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5043. preferenceHTMLStr += '</td>';
  5044. preferenceHTMLStr += '<td style="height:24px">';
  5045. preferenceHTMLStr += '<select id="TrapCheckInput" onchange="var isDisable = (value == \'false\') ? \'disabled\' : \'\'; document.getElementById(\'TrapCheckTimeDelayMinInput\').disabled=isDisable; document.getElementById(\'TrapCheckTimeDelayMaxInput\').disabled=isDisable;">';
  5046. if (enableTrapCheck) {
  5047. preferenceHTMLStr += '<option value="false">False</option>';
  5048. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5049. temp = '';
  5050. }
  5051. else {
  5052. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5053. preferenceHTMLStr += '<option value="true">True</option>';
  5054. temp = 'disabled';
  5055. }
  5056. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time to trap check (in seconds)"><b>Delay:</b></a>&emsp;';
  5057. preferenceHTMLStr += '<input type="number" id="TrapCheckTimeDelayMinInput" min="0" max="360" size="5" value="' + checkTimeDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5058. preferenceHTMLStr += '<input type="number" id="TrapCheckTimeDelayMaxInput" min="1" max="361" size="5" value="' + checkTimeDelayMax.toString() + '" ' + temp + '> seconds';
  5059. preferenceHTMLStr += '</td>';
  5060. preferenceHTMLStr += '</tr>';
  5061.  
  5062. preferenceHTMLStr += '<tr>';
  5063. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5064. preferenceHTMLStr += '<a title="Play sound when encounter king\'s reward"><b>Play King Reward Sound</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5065. preferenceHTMLStr += '</td>';
  5066. preferenceHTMLStr += '<td style="height:24px">';
  5067. preferenceHTMLStr += '<select id="PlayKingRewardSoundInput" >';
  5068. if (isKingWarningSound) {
  5069. preferenceHTMLStr += '<option value="false">False</option>';
  5070. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5071. }
  5072. else {
  5073. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5074. preferenceHTMLStr += '<option value="true">True</option>';
  5075. }
  5076. preferenceHTMLStr += '</select>';
  5077. preferenceHTMLStr += '</td>';
  5078. preferenceHTMLStr += '</tr>';
  5079.  
  5080. preferenceHTMLStr += '<tr>';
  5081. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5082. preferenceHTMLStr += '<a title="Solve King Reward automatically"><b>Auto Solve King Reward</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5083. preferenceHTMLStr += '</td>';
  5084. preferenceHTMLStr += '<td style="height:24px">';
  5085. preferenceHTMLStr += '<select id="AutoSolveKRInput" onchange="var isDisable = (value == \'false\') ? \'disabled\' : \'\'; document.getElementById(\'AutoSolveKRDelayMinInput\').disabled=isDisable; document.getElementById(\'AutoSolveKRDelayMaxInput\').disabled=isDisable;">';
  5086. if (isAutoSolve) {
  5087. preferenceHTMLStr += '<option value="false">False</option>';
  5088. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5089. temp = '';
  5090. }
  5091. else {
  5092. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5093. preferenceHTMLStr += '<option value="true">True</option>';
  5094. temp = 'disabled';
  5095. }
  5096. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time to solve King Reward (in seconds)"><b>Delay:</b></a>&emsp;';
  5097. preferenceHTMLStr += '<input type="number" id="AutoSolveKRDelayMinInput" min="0" max="360" size="5" value="' + krDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5098. preferenceHTMLStr += '<input type="number" id="AutoSolveKRDelayMaxInput" min="1" max="361" size="5" value="' + krDelayMax.toString() + '" ' + temp + '> seconds';
  5099. preferenceHTMLStr += '</td>';
  5100. preferenceHTMLStr += '</tr>';
  5101.  
  5102. preferenceHTMLStr += '<tr>';
  5103. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5104. preferenceHTMLStr += '<a title="Save King Reward image into localStorage"><b>Save King Reward Image</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5105. preferenceHTMLStr += '</td>';
  5106. preferenceHTMLStr += '<td style="height:24px">';
  5107. preferenceHTMLStr += '<select id="SaveKRImageInput" >';
  5108. if (saveKRImage) {
  5109. preferenceHTMLStr += '<option value="false">False</option>';
  5110. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5111. }
  5112. else {
  5113. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5114. preferenceHTMLStr += '<option value="true">True</option>';
  5115. }
  5116. preferenceHTMLStr += '</select>';
  5117. preferenceHTMLStr += '</td>';
  5118. preferenceHTMLStr += '</tr>';
  5119.  
  5120. preferenceHTMLStr += '<tr>';
  5121. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5122. preferenceHTMLStr += '<a title="View Saved King Reward Image from localStorage"><b>View King Reward Image</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5123. preferenceHTMLStr += '</td>';
  5124. preferenceHTMLStr += '<td style="height:24px">';
  5125. preferenceHTMLStr += '<select id="viewKR">';
  5126. preferenceHTMLStr += '</select>';
  5127. 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\');}">';
  5128. preferenceHTMLStr += '</td>';
  5129. preferenceHTMLStr += '</tr>';
  5130.  
  5131. preferenceHTMLStr += '<tr>';
  5132. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5133. 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;';
  5134. preferenceHTMLStr += '</td>';
  5135. preferenceHTMLStr += '<td style="height:24px">';
  5136. preferenceHTMLStr += '<select id="PauseLocationInput" >';
  5137. if (pauseAtInvalidLocation) {
  5138. preferenceHTMLStr += '<option value="false">False</option>';
  5139. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5140. }
  5141. else {
  5142. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5143. preferenceHTMLStr += '<option value="true">True</option>';
  5144. }
  5145. preferenceHTMLStr += '</select>';
  5146. preferenceHTMLStr += '</td>';
  5147. preferenceHTMLStr += '</tr>';
  5148.  
  5149. preferenceHTMLStr += '<tr>';
  5150. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Best Weapon for </b></a>';
  5151. preferenceHTMLStr += '<select id="selectBestTrapPowerType" style="width:75px;" onchange="initControlsBestTrap();">';
  5152. preferenceHTMLStr += '<option value="arcane">Arcane</option>';
  5153. preferenceHTMLStr += '<option value="draconic">Draconic</option>';
  5154. preferenceHTMLStr += '<option value="forgotten">Forgotten</option>';
  5155. preferenceHTMLStr += '<option value="hydro">Hydro</option>';
  5156. preferenceHTMLStr += '<option value="law">Law</option>';
  5157. preferenceHTMLStr += '<option value="physical">Physical</option>';
  5158. preferenceHTMLStr += '<option value="rift">Rift</option>';
  5159. preferenceHTMLStr += '<option value="shadow">Shadow</option>';
  5160. preferenceHTMLStr += '<option value="tactical">Tactical</option>';
  5161. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5162. preferenceHTMLStr += '</td>';
  5163. preferenceHTMLStr += '<td style="height:24px">';
  5164. preferenceHTMLStr += '<select id="selectBestTrapWeapon" style="width: 300px" onchange="saveBestTrap();">';
  5165. preferenceHTMLStr += '</select>';
  5166. preferenceHTMLStr += '</td>';
  5167. preferenceHTMLStr += '</tr>';
  5168.  
  5169. preferenceHTMLStr += '<tr>';
  5170. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Best Base for </b></a>';
  5171. preferenceHTMLStr += '<select id="selectBestTrapBaseType" style="width:75px;" onchange="initControlsBestTrap();">';
  5172. preferenceHTMLStr += '<option value="luck">Luck</option>';
  5173. preferenceHTMLStr += '<option value="power">Power</option>';
  5174. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5175. preferenceHTMLStr += '</td>';
  5176. preferenceHTMLStr += '<td style="height:24px">';
  5177. preferenceHTMLStr += '<select id="selectBestTrapBase" onchange="saveBestTrap();">';
  5178. preferenceHTMLStr += '</select>';
  5179. preferenceHTMLStr += '</td>';
  5180. preferenceHTMLStr += '</tr>';
  5181.  
  5182. preferenceHTMLStr += '<tr>';
  5183. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Support Me</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5184. preferenceHTMLStr += '<td style="height:24px">';
  5185. preferenceHTMLStr += '<input type="button" id="inputShowAds" value="Click to Show Ads" onclick="onIdAdsClicked()">';
  5186. preferenceHTMLStr += '</td>';
  5187. preferenceHTMLStr += '</tr>';
  5188.  
  5189. preferenceHTMLStr += '<tr>';
  5190. preferenceHTMLStr += '<td style="height:24px; text-align:right;" colspan="2">';
  5191. preferenceHTMLStr += '(Changes above this line only take place after user save the preference) ';
  5192. preferenceHTMLStr += '<input type="button" id="PreferenceSaveInput" value="Save" onclick="\
  5193. window.localStorage.setItem(\'AggressiveMode\', document.getElementById(\'AggressiveModeInput\').value);\
  5194. window.localStorage.setItem(\'HornTimeDelayMin\', document.getElementById(\'HornTimeDelayMinInput\').value);\
  5195. window.localStorage.setItem(\'HornTimeDelayMax\', document.getElementById(\'HornTimeDelayMaxInput\').value);\
  5196. window.localStorage.setItem(\'TrapCheck\', document.getElementById(\'TrapCheckInput\').value);\
  5197. window.localStorage.setItem(\'TrapCheckTimeDelayMin\', document.getElementById(\'TrapCheckTimeDelayMinInput\').value);\
  5198. window.localStorage.setItem(\'TrapCheckTimeDelayMax\', document.getElementById(\'TrapCheckTimeDelayMaxInput\').value);\
  5199. window.localStorage.setItem(\'PlayKingRewardSound\', document.getElementById(\'PlayKingRewardSoundInput\').value);\
  5200. window.localStorage.setItem(\'AutoSolveKR\', document.getElementById(\'AutoSolveKRInput\').value);\
  5201. window.localStorage.setItem(\'AutoSolveKRDelayMin\', document.getElementById(\'AutoSolveKRDelayMinInput\').value);\
  5202. window.localStorage.setItem(\'AutoSolveKRDelayMax\', document.getElementById(\'AutoSolveKRDelayMaxInput\').value);\
  5203. window.localStorage.setItem(\'SaveKRImage\', document.getElementById(\'SaveKRImageInput\').value);\
  5204. window.localStorage.setItem(\'PauseLocation\', document.getElementById(\'PauseLocationInput\').value);\
  5205. setSessionToLocal();\
  5206. for(var i=0;i<window.sessionStorage.length;i++){\
  5207. window.sessionStorage.removeItem(window.sessionStorage.key(i));\
  5208. }\
  5209. ';
  5210. if (fbPlatform)
  5211. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehuntgame.com/canvas/\';';
  5212. else if (hiFivePlatform)
  5213. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehunt.hi5.hitgrab.com/\';';
  5214. else if (mhPlatform)
  5215. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehuntgame.com/\';';
  5216.  
  5217. preferenceHTMLStr += temp + '"/>&nbsp;&nbsp;&nbsp;</td>';
  5218. preferenceHTMLStr += '</tr>';
  5219.  
  5220. preferenceHTMLStr += '<tr>';
  5221. preferenceHTMLStr += '<td style="height:24px" colspan="2">';
  5222. preferenceHTMLStr += '<div style="width: 100%; height: 1px; background: #000000; overflow: hidden;">';
  5223. preferenceHTMLStr += '</td>';
  5224. preferenceHTMLStr += '</tr>';
  5225.  
  5226. preferenceHTMLStr += '<tr id="trSpecialFeature" style="display:none;">';
  5227. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select special feature"><b>Special Feature</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5228. preferenceHTMLStr += '<td style="height:24px">';
  5229. preferenceHTMLStr += '<select id="selectSpecialFeature" onchange="onSelectSpecialFeature();">';
  5230. preferenceHTMLStr += '<option value="None">None</option>';
  5231. preferenceHTMLStr += '<option value="PILLOWCASE">Open Magical Pillowcase</option>';
  5232. preferenceHTMLStr += '</select>';
  5233. preferenceHTMLStr += '</td>';
  5234. preferenceHTMLStr += '</tr>';
  5235.  
  5236. preferenceHTMLStr += '<tr>';
  5237. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5238. preferenceHTMLStr += '<a title="Turn on/off Map Hunting feature"><b>Season 4 Map Hunting</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5239. preferenceHTMLStr += '</td>';
  5240. preferenceHTMLStr += '<td style="height:24px">';
  5241. preferenceHTMLStr += '<select id="selectMapHunting" onChange="onSelectMapHuntingChanged();">';
  5242. preferenceHTMLStr += '<option value="false">False</option>';
  5243. preferenceHTMLStr += '<option value="true">True</option>';
  5244. preferenceHTMLStr += '</select>';
  5245. preferenceHTMLStr += '</td>';
  5246. preferenceHTMLStr += '</tr>';
  5247.  
  5248. preferenceHTMLStr += '<tr id="trUncaughtMouse" style="display:none;">';
  5249. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5250. preferenceHTMLStr += '<a title="Click button Get to retrieve all uncaught mouse"><b>Uncaught Mouse</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5251. preferenceHTMLStr += '</td>';
  5252. preferenceHTMLStr += '<td style="height:24px">';
  5253. preferenceHTMLStr += '<select id="selectMouseList"></select>';
  5254. 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;';
  5255. preferenceHTMLStr += '<input type="button" id="inputGetMouse" title="Click to Get all uncaught mouse from treasure map" value="Refresh Uncaught Mouse List" onclick="onInputGetMouse();">';
  5256. preferenceHTMLStr += '</td>';
  5257. preferenceHTMLStr += '</tr>';
  5258.  
  5259. preferenceHTMLStr += '<tr id="trSelectedUncaughtMouse" style="display:none;">';
  5260. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select desired uncaught mouse"><b>Selected Mouse</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5261. preferenceHTMLStr += '<td style="height:24px">';
  5262. preferenceHTMLStr += '<input type="text" id="inputUncaughtMouse" value="" disabled>&nbsp;&nbsp;';
  5263. preferenceHTMLStr += '<input type="button" id="inputClearUncaughtMouse" title="Click to clear the selected mouse" value="Clear" onclick="onInputClearUncaughtMouse();">';
  5264. preferenceHTMLStr += '</td>';
  5265. preferenceHTMLStr += '</tr>';
  5266.  
  5267. preferenceHTMLStr += '<tr id="trCatchLogic" style="display:none;">';
  5268. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select desired catch logic"><b>Catch Logic</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5269. preferenceHTMLStr += '<td style="height:24px">';
  5270. preferenceHTMLStr += '<select id="selectCatchLogic" onchange="saveMapHunting();">';
  5271. preferenceHTMLStr += '<option value="OR">When either one of the Selected Mouse was caught</option>';
  5272. preferenceHTMLStr += '<option value="AND">When all of the Selected Mouse were caught</option>';
  5273. preferenceHTMLStr += '</select>';
  5274. preferenceHTMLStr += '</td>';
  5275. preferenceHTMLStr += '</tr>';
  5276.  
  5277. preferenceHTMLStr += '<tr id="trMapHuntingTrapSetup" style="display:none;">';
  5278. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5279. preferenceHTMLStr += '<a title="Select trap setup after catch logic is fulfilled"><b>After Caught</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5280. preferenceHTMLStr += '</td>';
  5281. preferenceHTMLStr += '<td style="height:24px">';
  5282. preferenceHTMLStr += '<select id="selectWeapon" style="width: 75px" onchange="saveMapHunting();">';
  5283. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5284. preferenceHTMLStr += '</select>';
  5285. preferenceHTMLStr += '<select id="selectBase" style="width: 75px" onchange="saveMapHunting();">';
  5286. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5287. preferenceHTMLStr += '</select>';
  5288. preferenceHTMLStr += '<select id="selectTrinket" style="width: 75px" onchange="saveMapHunting();">';
  5289. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5290. preferenceHTMLStr += '<option value="None">None</option>';
  5291. preferenceHTMLStr += '</select>';
  5292. preferenceHTMLStr += '<select id="selectBait" style="width: 75px" onchange="saveMapHunting();">';
  5293. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5294. preferenceHTMLStr += '<option value="None">None</option>';
  5295. preferenceHTMLStr += '</select>';
  5296. preferenceHTMLStr += '</td>';
  5297. preferenceHTMLStr += '</tr>';
  5298.  
  5299. preferenceHTMLStr += '<tr id="trMapHuntingLeave" style="display:none;">';
  5300. 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>';
  5301. preferenceHTMLStr += '<td style="height:24px">';
  5302. preferenceHTMLStr += '<select id="selectLeaveMap" onchange="saveMapHunting();">';
  5303. preferenceHTMLStr += '<option value="false">False</option>';
  5304. preferenceHTMLStr += '<option value="true">True</option>';
  5305. preferenceHTMLStr += '</select>';
  5306. preferenceHTMLStr += '</td>';
  5307. preferenceHTMLStr += '</tr>';
  5308.  
  5309. preferenceHTMLStr += '<tr>';
  5310. preferenceHTMLStr += '<td style="height:24px" colspan="2">';
  5311. preferenceHTMLStr += '<div style="width: 100%; height: 1px; background: #FFFFFF; overflow: hidden;">';
  5312. preferenceHTMLStr += '</td>';
  5313. preferenceHTMLStr += '</tr>';
  5314.  
  5315. preferenceHTMLStr += '<tr>';
  5316. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5317. preferenceHTMLStr += '<a title="Select the script algorithm based on certain event / location"><b>Event or Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5318. preferenceHTMLStr += '</td>';
  5319. preferenceHTMLStr += '<td style="height:24px">';
  5320. preferenceHTMLStr += '<select id="eventAlgo" style="width:150px" onChange="window.sessionStorage.setItem(\'eventLocation\', value); showOrHideTr(value);">';
  5321. preferenceHTMLStr += '<option value="None" selected>None</option>';
  5322. preferenceHTMLStr += '<option value="All LG Area">All LG Area</option>';
  5323. preferenceHTMLStr += '<option value="BC/JOD">BC => JOD</option>';
  5324. preferenceHTMLStr += '<option value="Bristle Woods Rift">Bristle Woods Rift</option>';
  5325. preferenceHTMLStr += '<option value="Burroughs Rift(Red)">Burroughs Rift(Red)</option>';
  5326. preferenceHTMLStr += '<option value="Burroughs Rift(Green)">Burroughs Rift(Green)</option>';
  5327. preferenceHTMLStr += '<option value="Burroughs Rift(Yellow)">Burroughs Rift(Yellow)</option>';
  5328. preferenceHTMLStr += '<option value="Burroughs Rift Custom">Burroughs Rift Custom</option>';
  5329. preferenceHTMLStr += '<option value="Charge Egg 2016 Medium + High">Charge Egg 2016 Medium + High</option>';
  5330. preferenceHTMLStr += '<option value="Charge Egg 2016 High">Charge Egg 2016 High</option>';
  5331. preferenceHTMLStr += '<option value="FG/AR">FG => AR</option>';
  5332. preferenceHTMLStr += '<option value="Fiery Warpath">Fiery Warpath</option>';
  5333. preferenceHTMLStr += '<option value="Fort Rox">Fort Rox</option>';
  5334. preferenceHTMLStr += '<option value="Furoma Rift">Furoma Rift</option>';
  5335. preferenceHTMLStr += '<option value="GES">Gnawnian Express Station</option>';
  5336. //preferenceHTMLStr += '<option value="GWH2016R">GWH 2016</option>';
  5337. preferenceHTMLStr += '<option value="Halloween 2016">Halloween 2016</option>';
  5338. preferenceHTMLStr += '<option value="Iceberg">Iceberg</option>';
  5339. preferenceHTMLStr += '<option value="Labyrinth">Labyrinth</option>';
  5340. preferenceHTMLStr += '<option value="SG">Seasonal Garden</option>';
  5341. preferenceHTMLStr += '<option value="Sunken City">Sunken City</option>';
  5342. preferenceHTMLStr += '<option value="Sunken City Custom">Sunken City Custom</option>';
  5343. preferenceHTMLStr += '<option value="Test">Test</option>';
  5344. preferenceHTMLStr += '<option value="WWRift">WWRift</option>';
  5345. preferenceHTMLStr += '<option value="Zokor">Zokor</option>';
  5346. preferenceHTMLStr += '<option value="ZT">Zugzwang\'s Tower</option>';
  5347. preferenceHTMLStr += '</select>';
  5348. preferenceHTMLStr += '<input type="button" id="inputResetReload" title="Reset setting of current selected algo" value="Reset & Reload" onclick="onInputResetReload();' + temp + '">';
  5349. preferenceHTMLStr += '</td>';
  5350. preferenceHTMLStr += '</tr>';
  5351.  
  5352. preferenceHTMLStr += '<tr id="trBCJODSubLocation" style="display:none;">';
  5353. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Sub-Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5354. preferenceHTMLStr += '<td style="height:24px">';
  5355. preferenceHTMLStr += '<select id="selectBCJODSublocation" onchange="initControlsBCJOD();">';
  5356. preferenceHTMLStr += '<option value="JOD">Jungle of Dread</option>';
  5357. preferenceHTMLStr += '<option value="LOW">BC Low Tide</option>';
  5358. preferenceHTMLStr += '<option value="MID">BC Mid Tide</option>';
  5359. preferenceHTMLStr += '<option value="HIGH">BC High Tide</option>';
  5360. preferenceHTMLStr += '</select>';
  5361. preferenceHTMLStr += '</td>';
  5362. preferenceHTMLStr += '</tr>';
  5363.  
  5364. preferenceHTMLStr += '<tr id="trBCJODTrapSetup" style="display:none;">';
  5365. 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>';
  5366. preferenceHTMLStr += '<td style="height:24px">';
  5367. preferenceHTMLStr += '<select id="selectBCJODWeapon" style="width: 75px;" onchange="saveBCJOD();">';
  5368. preferenceHTMLStr += '</select>';
  5369. preferenceHTMLStr += '<select id="selectBCJODBase" style="width: 75px;" onchange="saveBCJOD();">';
  5370. preferenceHTMLStr += '</select>';
  5371. preferenceHTMLStr += '<select id="selectBCJODTrinket" style="width: 75px;" onchange="saveBCJOD();">';
  5372. preferenceHTMLStr += '<option value="None">None</option>';
  5373. preferenceHTMLStr += '</select>';
  5374. preferenceHTMLStr += '<select id="selectBCJODBait" style="width: 75px;" onchange="saveBCJOD();">';
  5375. preferenceHTMLStr += '<option value="None">None</option>';
  5376. preferenceHTMLStr += '<option value="Vanilla Stilton Cheese">Vanilla Stilton Cheese</option>';
  5377. preferenceHTMLStr += '<option value="Vengeful Vanilla Stilton Cheese">Vengeful Vanilla Stilton Cheese</option>';
  5378. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5379. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5380. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5381. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5382. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5383. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5384. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5385. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5386. preferenceHTMLStr += '</select>';
  5387. preferenceHTMLStr += '</td>';
  5388. preferenceHTMLStr += '</tr>';
  5389.  
  5390. preferenceHTMLStr += '<tr id="trFGARSubLocation" style="display:none;">';
  5391. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Sub-Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5392. preferenceHTMLStr += '<td style="height:24px">';
  5393. preferenceHTMLStr += '<select id="selectFGARSublocation" onchange="initControlsFGAR();">';
  5394. preferenceHTMLStr += '<option value="FG">Forbidden Grove</option>';
  5395. preferenceHTMLStr += '<option value="AR">Acolyte Realm</option>';
  5396. preferenceHTMLStr += '</select>';
  5397. preferenceHTMLStr += '</td>';
  5398. preferenceHTMLStr += '</tr>';
  5399.  
  5400. preferenceHTMLStr += '<tr id="trFGARTrapSetup" style="display:none;">';
  5401. 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>';
  5402. preferenceHTMLStr += '<td style="height:24px">';
  5403. preferenceHTMLStr += '<select id="selectFGARWeapon" style="width: 75px;" onchange="saveFGAR();">';
  5404. preferenceHTMLStr += '</select>';
  5405. preferenceHTMLStr += '<select id="selectFGARBase" style="width: 75px;" onchange="saveFGAR();">';
  5406. preferenceHTMLStr += '</select>';
  5407. preferenceHTMLStr += '<select id="selectFGARTrinket" style="width: 75px;" onchange="saveFGAR();">';
  5408. preferenceHTMLStr += '<option value="None">None</option>';
  5409. preferenceHTMLStr += '</select>';
  5410. preferenceHTMLStr += '<select id="selectFGARBait" style="width: 75px;" onchange="saveFGAR();">';
  5411. preferenceHTMLStr += '<option value="None">None</option>';
  5412. preferenceHTMLStr += '<option value="Runic Cheese">Runic Cheese</option>';
  5413. preferenceHTMLStr += '<option value="Ancient Cheese">Ancient Cheese</option>';
  5414. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5415. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5416. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5417. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5418. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5419. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5420. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5421. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5422. preferenceHTMLStr += '</select>';
  5423. preferenceHTMLStr += '</td>';
  5424. preferenceHTMLStr += '</tr>';
  5425.  
  5426. preferenceHTMLStr += '<tr id="trBWRiftAutoChoosePortal" style="display:none;">';
  5427. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Choose portal automatically"><b>Auto Choose Portal</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5428. preferenceHTMLStr += '<td style="height:24px">';
  5429. preferenceHTMLStr += '<select id="selectBWRiftChoosePortal" style="width: 75px;" onchange="onSelectBWRiftChoosePortal();">';
  5430. preferenceHTMLStr += '<option value="false">False</option>';
  5431. preferenceHTMLStr += '<option value="true">True</option>';
  5432. preferenceHTMLStr += '</select>';
  5433. preferenceHTMLStr += '</td>';
  5434. preferenceHTMLStr += '</tr>';
  5435.  
  5436. preferenceHTMLStr += '<tr id="trBWRiftChoosePortalAfterCC" style="display:none;">';
  5437. 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>';
  5438. preferenceHTMLStr += '<td style="height:24px">';
  5439. preferenceHTMLStr += '<select id="selectBWRiftChoosePortalAfterCC" style="width: 75px;" onchange="saveBWRift();">';
  5440. preferenceHTMLStr += '<option value="false">False</option>';
  5441. preferenceHTMLStr += '<option value="true">True</option>';
  5442. preferenceHTMLStr += '</select>&nbsp;&nbsp;After Chamber Cleaver Caught';
  5443. preferenceHTMLStr += '</td>';
  5444. preferenceHTMLStr += '</tr>';
  5445.  
  5446. preferenceHTMLStr += '<tr id="trBWRiftPortalPriority" style="display:none;">';
  5447. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select portal priority"><b>Portal Priority </b></a>';
  5448. preferenceHTMLStr += '<select id="selectBWRiftPriority" style="width: 75px;" onchange="initControlsBWRift();">';
  5449. for(i=1;i<=13;i++){
  5450. if(i==1)
  5451. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Highest)</option>';
  5452. else if(i==13)
  5453. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Lowest)</option>';
  5454. else
  5455. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5456. }
  5457. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5458. preferenceHTMLStr += '</td>';
  5459. preferenceHTMLStr += '<td style="height:24px">';
  5460. preferenceHTMLStr += '<select id="selectBWRiftPortal" onchange="saveBWRift();">';
  5461. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5462. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5463. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5464. preferenceHTMLStr += '<option value="AL/RL_MSC">AL/RL (MSC)</option>';
  5465. preferenceHTMLStr += '<option value="AL/RL_BSC">AL/RL (BSC)</option>';
  5466. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5467. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5468. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5469. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5470. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5471. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5472. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5473. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5474. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5475. preferenceHTMLStr += '<option value="ACOLYTE">Acolyte Chamber</option>';
  5476. preferenceHTMLStr += '</select>';
  5477. preferenceHTMLStr += '</td>';
  5478. preferenceHTMLStr += '</tr>';
  5479.  
  5480. preferenceHTMLStr += '<tr id="trBWRiftPortalPriorityCursed" style="display:none;">';
  5481. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select portal priority when get cursed"><b>Portal Priority - Cursed </b></a>';
  5482. preferenceHTMLStr += '<select id="selectBWRiftPriorityCursed" style="width: 75px;" onchange="initControlsBWRift();">';
  5483. for(i=1;i<=13;i++){
  5484. if(i==1)
  5485. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Highest)</option>';
  5486. else if(i==13)
  5487. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Lowest)</option>';
  5488. else
  5489. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5490. }
  5491. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5492. preferenceHTMLStr += '</td>';
  5493. preferenceHTMLStr += '<td style="height:24px">';
  5494. preferenceHTMLStr += '<select id="selectBWRiftPortalCursed" onchange="saveBWRift();">';
  5495. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5496. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5497. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5498. preferenceHTMLStr += '<option value="AL/RL_MSC">AL/RL (MSC)</option>';
  5499. preferenceHTMLStr += '<option value="AL/RL_BSC">AL/RL (BSC)</option>';
  5500. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5501. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5502. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5503. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5504. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5505. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5506. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5507. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5508. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5509. preferenceHTMLStr += '<option value="ACOLYTE">Acolyte Chamber</option>';
  5510. preferenceHTMLStr += '</select>';
  5511. preferenceHTMLStr += '</td>';
  5512. preferenceHTMLStr += '</tr>';
  5513.  
  5514. preferenceHTMLStr += '<tr id="trBWRiftMinTimeSand" style="display:none;">';
  5515. 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>';
  5516. preferenceHTMLStr += '<select id="selectBWRiftBuffCurse" style="width: 75px;" onchange="initControlsBWRift();">';
  5517. preferenceHTMLStr += '<option value="0">No Buff & No Curse</option>';
  5518. preferenceHTMLStr += '<option value="1">Fourth Portal & No Curse</option>';
  5519. preferenceHTMLStr += '<option value="2">Acolyte Influence & No Curse</option>';
  5520. preferenceHTMLStr += '<option value="3">Acolyte Influence + Fourth Portal & No Curse</option>';
  5521. preferenceHTMLStr += '<option value="4">Paladin\'s Bane & No Curse</option>';
  5522. preferenceHTMLStr += '<option value="5">Paladin\'s Bane + Fourth Portal & No Curse</option>';
  5523. preferenceHTMLStr += '<option value="6">Paladin\'s Bane + Acolyte Influence & No Curse</option>';
  5524. preferenceHTMLStr += '<option value="7">All Buffs & No Curse</option>';
  5525. preferenceHTMLStr += '<option value="8">Buff(s) & Curse(s)</option>';
  5526. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5527. preferenceHTMLStr += '<td style="height:24px">';
  5528. preferenceHTMLStr += '<input type="number" id="inputMinTimeSand" min="0" max="99999" style="width:75px" value="50" onchange="onInputMinTimeSandChanged(this);">&nbsp;&nbsp;Before Enter AC';
  5529. preferenceHTMLStr += '</td>';
  5530. preferenceHTMLStr += '</tr>';
  5531.  
  5532. preferenceHTMLStr += '<tr id="trBWRiftMinRSC" style="display:none;">';
  5533. 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>';
  5534. preferenceHTMLStr += '<td style="height:24px">';
  5535. preferenceHTMLStr += '<select id="selectBWRiftMinRSCType" style="width: 75px;" onchange="onSelectBWRiftMinRSCType();">';
  5536. preferenceHTMLStr += '<option value="NUMBER">Number</option>';
  5537. preferenceHTMLStr += '<option value="GEQ">Greater or Equal to Min Time Sand</option>';
  5538. preferenceHTMLStr += '</select>';
  5539. preferenceHTMLStr += '<input type="number" id="inputMinRSC" min="0" max="99999" style="width:75px" value="50" onchange="onInputMinRSCChanged(this);">&nbsp;&nbsp;Before Enter AC';
  5540. preferenceHTMLStr += '</td>';
  5541. preferenceHTMLStr += '</tr>';
  5542.  
  5543. preferenceHTMLStr += '<tr id="trBWRiftEnterMinigame" style="display:none;">';
  5544. 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>';
  5545. preferenceHTMLStr += '<td style="height:24px">';
  5546. preferenceHTMLStr += '<select id="selectBWRiftEnterWCurse" style="width: 75px;" onchange="saveBWRift();">';
  5547. preferenceHTMLStr += '<option value="false">False</option>';
  5548. preferenceHTMLStr += '<option value="true">True</option>';
  5549. preferenceHTMLStr += '</select>';
  5550. preferenceHTMLStr += '</td>';
  5551. preferenceHTMLStr += '</tr>';
  5552.  
  5553. preferenceHTMLStr += '<tr id="trBWRiftSubLocation" style="display:none;">';
  5554. 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>';
  5555. preferenceHTMLStr += '<td style="height:24px">';
  5556. preferenceHTMLStr += '<select id="selectBWRiftChamber" onchange="initControlsBWRift();">';
  5557. preferenceHTMLStr += '<option value="NONE">Non-Chamber</option>';
  5558. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5559. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5560. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5561. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5562. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5563. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5564. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5565. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5566. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5567. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5568. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5569. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5570. preferenceHTMLStr += '<option value="ACOLYTE_CHARGING">Acolyte Chamber Charging</option>';
  5571. preferenceHTMLStr += '<option value="ACOLYTE_DRAINING">Acolyte Chamber Draining</option>';
  5572. preferenceHTMLStr += '<option value="ACOLYTE_DRAINED">Acolyte Chamber Drained</option>';
  5573. preferenceHTMLStr += '<option value="SEPARATOR" disabled>========= Separator =========</option>';
  5574. preferenceHTMLStr += '<option value="NONE_CURSED">Non-Chamber Cursed</option>';
  5575. preferenceHTMLStr += '<option value="GEARWORKS_CURSED">Gearworks Cursed</option>';
  5576. preferenceHTMLStr += '<option value="ANCIENT_CURSED">Ancient Lab Cursed</option>';
  5577. preferenceHTMLStr += '<option value="RUNIC_CURSED">Runic Laboratory Cursed</option>';
  5578. preferenceHTMLStr += '<option value="TIMEWARP_CURSED">Timewarp Chamber Cursed</option>';
  5579. preferenceHTMLStr += '<option value="LUCKY_CURSED">Lucky Tower Cursed</option>';
  5580. preferenceHTMLStr += '<option value="HIDDEN_CURSED">Hidden Treasury Cursed</option>';
  5581. preferenceHTMLStr += '<option value="GUARD_CURSED">Guard Barracks Cursed</option>';
  5582. preferenceHTMLStr += '<option value="SECURITY_CURSED">Security Chamber Cursed</option>';
  5583. preferenceHTMLStr += '<option value="FROZEN_CURSED">Frozen Alcove Cursed</option>';
  5584. preferenceHTMLStr += '<option value="FURNACE_CURSED">Furnace Room Cursed</option>';
  5585. preferenceHTMLStr += '<option value="INGRESS_CURSED">Ingress Chamber Cursed</option>';
  5586. preferenceHTMLStr += '<option value="PURSUER_CURSED">Pursuer Mousoleum Cursed</option>';
  5587. preferenceHTMLStr += '<option value="ACOLYTE_CHARGING_CURSED">Acolyte Chamber Charging Cursed</option>';
  5588. preferenceHTMLStr += '<option value="ACOLYTE_DRAINING_CURSED">Acolyte Chamber Draining Cursed</option>';
  5589. preferenceHTMLStr += '<option value="ACOLYTE_DRAINED_CURSED">Acolyte Chamber Drained Cursed</option>';
  5590. preferenceHTMLStr += '</select>';
  5591. preferenceHTMLStr += '</td>';
  5592. preferenceHTMLStr += '</tr>';
  5593.  
  5594. preferenceHTMLStr += '<tr id="trBWRiftMasterTrapSetup" style="display:none;">';
  5595. 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>';
  5596. preferenceHTMLStr += '<td style="height:24px">';
  5597. preferenceHTMLStr += '<select id="selectBWRiftWeapon" style="width: 75px;" onchange="saveBWRift();">';
  5598. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  5599. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5600. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5601. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5602. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  5603. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5604. preferenceHTMLStr += '</select>';
  5605. preferenceHTMLStr += '<select id="selectBWRiftBase" style="width: 75px;" onchange="saveBWRift();">';
  5606. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  5607. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  5608. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  5609. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  5610. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  5611. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  5612. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  5613. preferenceHTMLStr += '</select>';
  5614. preferenceHTMLStr += '<select id="selectBWRiftTrinket" style="width: 75px;" onchange="saveBWRift();">';
  5615. preferenceHTMLStr += '<option value="None">None</option>';
  5616. preferenceHTMLStr += '</select>';
  5617. preferenceHTMLStr += '<select id="selectBWRiftBait" style="width: 75px;" onchange="saveBWRift();">';
  5618. preferenceHTMLStr += '<option value="None">None</option>';
  5619. preferenceHTMLStr += '<option value="Runic String">Runic</option>';
  5620. preferenceHTMLStr += '<option value="Ancient String">Ancient</option>';
  5621. preferenceHTMLStr += '<option value="Runic/Ancient">Runic/Ancient</option>';
  5622. preferenceHTMLStr += '<option value="Runic=>Ancient">Runic=>Ancient</option>';
  5623. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5624. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5625. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5626. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5627. preferenceHTMLStr += '</select>';
  5628. preferenceHTMLStr += '<select id="selectBWRiftActivatePocketWatch" style="width: 75px;" onchange="saveBWRift();">';
  5629. preferenceHTMLStr += '<option value="false">Deactivate Quantum Pocketwatch</option>';
  5630. preferenceHTMLStr += '<option value="true">Activate Quantum Pocketwatch</option>';
  5631. preferenceHTMLStr += '</select>';
  5632. preferenceHTMLStr += '</td>';
  5633. preferenceHTMLStr += '</tr>';
  5634.  
  5635. preferenceHTMLStr += '<tr id="trBWRiftTrapSetupSpecial" style="display:none;">';
  5636. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current chamber"><b>Conditional Trap Setup </b></a>';
  5637. preferenceHTMLStr += '<select id="selectBWRiftCleaverStatus" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5638. preferenceHTMLStr += '<option value="0">Cleaver Not Available</option>';
  5639. preferenceHTMLStr += '<option value="1">Cleaver Available</option>';
  5640. preferenceHTMLStr += '</select>';
  5641. preferenceHTMLStr += '<select id="selectBWRiftAlertLvl" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5642. for(i=0;i<=6;i++)
  5643. preferenceHTMLStr += '<option value="' + i + '">Alert Lvl ' + i + '</option>';
  5644. preferenceHTMLStr += '</select>';
  5645. preferenceHTMLStr += '<select id="selectBWRiftFTC" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5646. for(i=0;i<=3;i++)
  5647. preferenceHTMLStr += '<option value="' + i + '">FTC ' + i + '</option>';
  5648. preferenceHTMLStr += '</select>';
  5649. preferenceHTMLStr += '<select id="selectBWRiftHunt" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5650. for(i=0;i<=15;i++)
  5651. preferenceHTMLStr += '<option value="' + i + '">Hunt ' + i + '</option>';
  5652. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5653. preferenceHTMLStr += '</td>';
  5654. preferenceHTMLStr += '<td style="height:24px">';
  5655. preferenceHTMLStr += '<select id="selectBWRiftWeaponSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5656. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5657. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  5658. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5659. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5660. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5661. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  5662. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5663. preferenceHTMLStr += '</select>';
  5664. preferenceHTMLStr += '<select id="selectBWRiftBaseSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5665. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5666. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  5667. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  5668. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  5669. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  5670. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  5671. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  5672. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  5673. preferenceHTMLStr += '</select>';
  5674. preferenceHTMLStr += '<select id="selectBWRiftTrinketSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5675. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5676. preferenceHTMLStr += '<option value="None">None</option>';
  5677. preferenceHTMLStr += '</select>';
  5678. preferenceHTMLStr += '<select id="selectBWRiftBaitSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5679. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5680. preferenceHTMLStr += '<option value="None">None</option>';
  5681. preferenceHTMLStr += '<option value="Runic String">Runic</option>';
  5682. preferenceHTMLStr += '<option value="Ancient String">Ancient</option>';
  5683. preferenceHTMLStr += '<option value="Runic/Ancient">Runic/Ancient</option>';
  5684. preferenceHTMLStr += '<option value="Runic=>Ancient">Runic=>Ancient</option>';
  5685. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5686. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5687. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5688. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5689. preferenceHTMLStr += '</select>';
  5690. preferenceHTMLStr += '<select id="selectBWRiftActivatePocketWatchSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5691. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5692. preferenceHTMLStr += '<option value="false">Deactivate Quantum Pocketwatch</option>';
  5693. preferenceHTMLStr += '<option value="true">Activate Quantum Pocketwatch</option>';
  5694. preferenceHTMLStr += '</select>';
  5695. preferenceHTMLStr += '</td>';
  5696. preferenceHTMLStr += '</tr>';
  5697.  
  5698. preferenceHTMLStr += '<tr id="trBWRiftActivatePocketWatch" style="display:none;">';
  5699. 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>';
  5700. preferenceHTMLStr += '<td style="height:24px">';
  5701. preferenceHTMLStr += '<select id="selectBWRiftForceActiveQuantum" style="width: 75px;" onchange="onSelectBWRiftForceActiveQuantum();">';
  5702. preferenceHTMLStr += '<option value="false">False</option>';
  5703. preferenceHTMLStr += '<option value="true">True</option>';
  5704. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Remaining Loot/Obelisk Charge &le;&nbsp;&nbsp;:&nbsp;&nbsp;';
  5705. preferenceHTMLStr += '<input type="number" id="inputRemainingLootA" min="1" max="100" size="5" value="1" onchange="onInputRemaininigLootAChanged(this);">';
  5706. preferenceHTMLStr += '</td>';
  5707. preferenceHTMLStr += '</tr>';
  5708.  
  5709. preferenceHTMLStr += '<tr id="trBWRiftDeactivatePocketWatch" style="display:none;">';
  5710. 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>';
  5711. preferenceHTMLStr += '<td style="height:24px">';
  5712. preferenceHTMLStr += '<select id="selectBWRiftForceDeactiveQuantum" style="width: 75px;" onchange="onSelectBWRiftForceDeactiveQuantum();">';
  5713. preferenceHTMLStr += '<option value="false">False</option>';
  5714. preferenceHTMLStr += '<option value="true">True</option>';
  5715. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Remaining Loot/Obelisk Charge &le;&nbsp;&nbsp;:&nbsp;&nbsp;';
  5716. preferenceHTMLStr += '<input type="number" id="inputRemainingLootD" min="1" max="100" size="5" value="1" onchange="onInputRemaininigLootDChanged(this);">';
  5717. preferenceHTMLStr += '</td>';
  5718. preferenceHTMLStr += '</tr>';
  5719.  
  5720. preferenceHTMLStr += '<tr id="trFRoxTrapSetup" style="display:none;">';
  5721. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current stage"><b>Trap Setup for </b></a>';
  5722. preferenceHTMLStr += '<select id="selectFRoxStage" onchange="initControlsFRox();">';
  5723. preferenceHTMLStr += '<option value="DAY">Day</option>';
  5724. preferenceHTMLStr += '<option value="TWILIGHT">Twilight</option>';
  5725. preferenceHTMLStr += '<option value="MIDNIGHT">Midnight</option>';
  5726. preferenceHTMLStr += '<option value="PITCH">Pitch</option>';
  5727. preferenceHTMLStr += '<option value="UTTER">Utter Darkness</option>';
  5728. preferenceHTMLStr += '<option value="FIRST">First Light</option>';
  5729. preferenceHTMLStr += '<option value="DAWN">Dawn</option>';
  5730. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5731. preferenceHTMLStr += '</td>';
  5732. preferenceHTMLStr += '<td style="height:24px">';
  5733. preferenceHTMLStr += '<select id="selectFRoxWeapon" style="width: 75px;" onchange="saveFRox();"></select>';
  5734. preferenceHTMLStr += '<select id="selectFRoxBase" style="width: 75px;" onchange="saveFRox();"></select>';
  5735. preferenceHTMLStr += '<select id="selectFRoxTrinket" style="width: 75px;" onchange="saveFRox();">';
  5736. preferenceHTMLStr += '<option value="None">None</option>';
  5737. preferenceHTMLStr += '</select>';
  5738. preferenceHTMLStr += '<select id="selectFRoxBait" style="width: 75px;" onchange="saveFRox();">';
  5739. preferenceHTMLStr += '<option value="None">None</option>';
  5740. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5741. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5742. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5743. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5744. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5745. preferenceHTMLStr += '<option value="Crescent">Crescent</option>';
  5746. preferenceHTMLStr += '<option value="Moon">Moon</option>';
  5747. preferenceHTMLStr += '<option value="ANY_LUNAR">Moon/Crescent</option>';
  5748. preferenceHTMLStr += '<option value="Moon=>Crescent">Moon=>Crescent</option>';
  5749. preferenceHTMLStr += '<option value="Crescent=>Moon">Crescent=>Moon</option>';
  5750. preferenceHTMLStr += '</select>';
  5751. preferenceHTMLStr += '<select id="selectFRoxActivateTower" style="width: 75px;" onchange="saveFRox();">';
  5752. preferenceHTMLStr += '<option value="false">Deactivate Tower</option>';
  5753. preferenceHTMLStr += '<option value="true">Activate Tower</option>';
  5754. preferenceHTMLStr += '</select>';
  5755. preferenceHTMLStr += '</td>';
  5756. preferenceHTMLStr += '</tr>';
  5757.  
  5758. preferenceHTMLStr += '<tr id="trFRoxDeactiveTower" style="display:none;">';
  5759. 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>';
  5760. preferenceHTMLStr += '<td style="height:24px">';
  5761. preferenceHTMLStr += '<select id="selectFRoxFullHPDeactivate" onchange="saveFRox();">';
  5762. preferenceHTMLStr += '<option value="false">False</option>';
  5763. preferenceHTMLStr += '<option value="true">True</option>';
  5764. preferenceHTMLStr += '</select>';
  5765. preferenceHTMLStr += '</td>';
  5766. preferenceHTMLStr += '</tr>';
  5767.  
  5768. preferenceHTMLStr += '<tr id="trGESTrapSetup" style="display:none;">';
  5769. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup at </b></a>';
  5770. preferenceHTMLStr += '<select id="selectGESStage" style="width: 75px;" onchange="initControlsGES();">';
  5771. preferenceHTMLStr += '<option value="SD_BEFORE">Supply Depot (No Supply Rush)</option>';
  5772. preferenceHTMLStr += '<option value="SD_AFTER">Supply Depot (Supply Rush)</option>';
  5773. preferenceHTMLStr += '<option value="RR">Raider River</option>';
  5774. preferenceHTMLStr += '<option value="DC">Daredevil Canyon</option>';
  5775. preferenceHTMLStr += '<option value="WAITING">Waiting</option>';
  5776. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5777. preferenceHTMLStr += '</td>';
  5778. preferenceHTMLStr += '<td style="height:24px">';
  5779. preferenceHTMLStr += '<select id="selectGESTrapWeapon" style="width: 75px;" onchange="saveGES();">';
  5780. preferenceHTMLStr += '<option value="S.L.A.C.">S.L.A.C.</option>';
  5781. preferenceHTMLStr += '<option value="S.L.A.C. II">S.L.A.C. II</option>';
  5782. preferenceHTMLStr += '<option value="Supply Grabber">Supply Grabber</option>';
  5783. preferenceHTMLStr += '<option value="Bandit Deflector">Bandit Deflector</option>';
  5784. preferenceHTMLStr += '<option value="Engine Doubler">Engine Doubler</option>';
  5785. preferenceHTMLStr += '<option value="The Law Draw">The Law Draw</option>';
  5786. preferenceHTMLStr += '<option value="Law Laser Trap">Law Laser Trap</option>';
  5787. preferenceHTMLStr += '<option value="Meteor Prison Core Trap">Meteor Prison Core Trap</option>';
  5788. preferenceHTMLStr += '</select>';
  5789. preferenceHTMLStr += '<select id="selectGESTrapBase" style="width: 75px" onchange="saveGES();">';
  5790. preferenceHTMLStr += '</select>';
  5791. preferenceHTMLStr += '<select id="selectGESTrapTrinket" style="width: 75px;" onchange="saveGES();">';
  5792. preferenceHTMLStr += '<option value="None">None</option>';
  5793. preferenceHTMLStr += '</select>';
  5794. preferenceHTMLStr += '<select id="selectGESRRTrapTrinket" style="width: 75px;display:none" onchange="saveGES();">';
  5795. preferenceHTMLStr += '<option value="None">None</option>';
  5796. preferenceHTMLStr += '<option value="AUTO">Roof Rack/Door Guard/Greasy Glob</option>';
  5797. preferenceHTMLStr += '</select>';
  5798. preferenceHTMLStr += '<select id="selectGESDCTrapTrinket" style="width: 75px;display:none" onchange="saveGES();">';
  5799. preferenceHTMLStr += '<option value="None">None</option>';
  5800. preferenceHTMLStr += '<option value="AUTO">Magmatic Crystal/Black Powder/Dusty Coal</option>';
  5801. preferenceHTMLStr += '</select>';
  5802. preferenceHTMLStr += '<select id="selectGESTrapBait" style="width: 75px" onchange="saveGES();">';
  5803. preferenceHTMLStr += '<option value="None">None</option>';
  5804. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5805. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5806. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5807. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5808. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5809. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5810. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5811. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5812. preferenceHTMLStr += '</select>';
  5813. preferenceHTMLStr += '</td>';
  5814. preferenceHTMLStr += '</tr>';
  5815.  
  5816. preferenceHTMLStr += '<tr id="trGESSDLoadCrate" style="display:none;">';
  5817. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Load Crate</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5818. preferenceHTMLStr += '<td style="height:24px">';
  5819. preferenceHTMLStr += '<select id="selectGESSDLoadCrate" onchange="onSelectGESSDLoadCrate();">';
  5820. preferenceHTMLStr += '<option value="false">False</option>';
  5821. preferenceHTMLStr += '<option value="true">True</option>';
  5822. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Crate &ge; :</b></a>&nbsp;';
  5823. preferenceHTMLStr += '<input type="number" id="inputMinCrate" min="1" max="50" size="5" value="11" onchange="saveGES(this);">';
  5824. preferenceHTMLStr += '</td>';
  5825. preferenceHTMLStr += '</tr>';
  5826.  
  5827. preferenceHTMLStr += '<tr id="trGESRRRepellent" style="display:none;">';
  5828. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Use Repellent</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5829. preferenceHTMLStr += '<td style="height:24px">';
  5830. preferenceHTMLStr += '<select id="selectGESRRRepellent" onchange="onSelectGESRRRepellent();">';
  5831. preferenceHTMLStr += '<option value="false">False</option>';
  5832. preferenceHTMLStr += '<option value="true">True</option>';
  5833. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Repellent &ge; :</b></a>&nbsp;';
  5834. preferenceHTMLStr += '<input type="number" id="inputMinRepellent" min="1" max="50" size="5" value="11" onchange="saveGES(this);">';
  5835. preferenceHTMLStr += '</td>';
  5836. preferenceHTMLStr += '</tr>';
  5837.  
  5838. preferenceHTMLStr += '<tr id="trGESDCStokeEngine" style="display:none;">';
  5839. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Stoke Engine</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5840. preferenceHTMLStr += '<td style="height:24px">';
  5841. preferenceHTMLStr += '<select id="selectGESDCStokeEngine" onchange="onSelectGESDCStokeEngine();">';
  5842. preferenceHTMLStr += '<option value="false">False</option>';
  5843. preferenceHTMLStr += '<option value="true">True</option>';
  5844. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Fuel Nuggests &ge;:</b></a>&nbsp;';
  5845. preferenceHTMLStr += '<input type="number" id="inputMinFuelNugget" min="1" max="20" size="5" value="20" onchange="saveGES(this);">';
  5846. preferenceHTMLStr += '</td>';
  5847. preferenceHTMLStr += '</tr>';
  5848.  
  5849. preferenceHTMLStr += '<tr id="trWWRiftFactionFocus" style="display:none;">';
  5850. 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>';
  5851. preferenceHTMLStr += '<td style="height:24px">';
  5852. preferenceHTMLStr += '<select id="selectWWRiftFaction" onchange="onSelectWWRiftFaction();">';
  5853. preferenceHTMLStr += '<option value="CC">Crazed Clearing</option>';
  5854. preferenceHTMLStr += '<option value="GGT">Gigantic Gnarled Tree</option>';
  5855. preferenceHTMLStr += '<option value="DL">Deep Lagoon</option>';
  5856. preferenceHTMLStr += '<option value="MBW_40_44">MBW 40 &le; Rage &le; 44</option>';
  5857. preferenceHTMLStr += '<option value="MBW_45_48">MBW 45 &le; Rage &le; 48</option>';
  5858. preferenceHTMLStr += '</select>';
  5859. preferenceHTMLStr += '</td>';
  5860. preferenceHTMLStr += '</tr>';
  5861.  
  5862. preferenceHTMLStr += '<tr id="trWWRiftFactionFocusNext" style="display:none;">';
  5863. 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>';
  5864. preferenceHTMLStr += '<td style="height:24px">';
  5865. preferenceHTMLStr += '<select id="selectWWRiftFactionNext" onchange="saveWWRift();">';
  5866. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5867. preferenceHTMLStr += '<option value="CC">Crazed Clearing</option>';
  5868. preferenceHTMLStr += '<option value="GGT">Gigantic Gnarled Tree</option>';
  5869. preferenceHTMLStr += '<option value="DL">Deep Lagoon</option>';
  5870. preferenceHTMLStr += '</select>';
  5871. preferenceHTMLStr += '</td>';
  5872. preferenceHTMLStr += '</tr>';
  5873.  
  5874. preferenceHTMLStr += '<tr id="trWWRiftTrapSetup" style="display:none;">';
  5875. 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>';
  5876. preferenceHTMLStr += '<select id="selectWWRiftRage" onchange="initControlsWWRift();">';
  5877. preferenceHTMLStr += '<option value="0">0-24</option>';
  5878. preferenceHTMLStr += '<option value="25">25-49</option>';
  5879. preferenceHTMLStr += '<option value="50">50</option>';
  5880. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5881. preferenceHTMLStr += '</td>';
  5882. preferenceHTMLStr += '<td style="height:24px">';
  5883. preferenceHTMLStr += '<select id="selectWWRiftTrapWeapon" onchange="saveWWRift();">';
  5884. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  5885. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5886. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5887. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5888. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  5889. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5890. preferenceHTMLStr += '</select>';
  5891. preferenceHTMLStr += '<select id="selectWWRiftTrapBase" style="width: 75px" onchange="saveWWRift();">';
  5892. preferenceHTMLStr += '</select>';
  5893. preferenceHTMLStr += '<select id="selectWWRiftTrapTrinket" style="width: 75px" onchange="saveWWRift();">';
  5894. preferenceHTMLStr += '<option value="None">None</option>';
  5895. preferenceHTMLStr += '<option value="FSC">Faction Specific Charm</option>';
  5896. preferenceHTMLStr += '</select>';
  5897. preferenceHTMLStr += '<select id="selectWWRiftTrapBait" onchange="saveWWRift();">';
  5898. preferenceHTMLStr += '<option value="None">None</option>';
  5899. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5900. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5901. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5902. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5903. preferenceHTMLStr += '</select>';
  5904. preferenceHTMLStr += '</td>';
  5905. preferenceHTMLStr += '</tr>';
  5906.  
  5907. preferenceHTMLStr += '<tr id="trWWRiftMBWMinRage" style="display:none;">';
  5908. 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>';
  5909. preferenceHTMLStr += '<td style="height:24px">';
  5910. preferenceHTMLStr += '<input type="number" id="inputMinRage" min="40" max="48" size="5" value="40" onchange="onInputMinRageChanged(this);">';
  5911. preferenceHTMLStr += '</td>';
  5912. preferenceHTMLStr += '</tr>';
  5913.  
  5914. preferenceHTMLStr += '<tr id="trWWRiftMBWTrapSetup" style="display:none;">';
  5915. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup When </b></a>';
  5916. preferenceHTMLStr += '<select id="selectWWRiftMBWBar4044" style="width: 75px; display:none" onchange="initControlsWWRift();">';
  5917. preferenceHTMLStr += '<option value="25_0">0 Bar &ge; 25 Rage</option>';
  5918. preferenceHTMLStr += '<option value="25_1">1 Bar &ge; 25 Rage</option>';
  5919. preferenceHTMLStr += '<option value="25_2">2 Bars &ge; 25 Rage</option>';
  5920. preferenceHTMLStr += '<option value="MIN_RAGE_0">3 Bars &ge; 25 Rage / 0 Bar &ge; Min Rage to Hunt MBW</option>';
  5921. preferenceHTMLStr += '<option value="MIN_RAGE_1">1 Bar &ge; Min Rage to Hunt MBW</option>';
  5922. preferenceHTMLStr += '<option value="MIN_RAGE_2">2 Bars &ge; Min Rage to Hunt MBW</option>';
  5923. preferenceHTMLStr += '<option value="MIN_RAGE_3">3 Bars &ge; Min Rage to Hunt MBW</option>';
  5924. preferenceHTMLStr += '</select>';
  5925. preferenceHTMLStr += '<select id="selectWWRiftMBWBar4548" style="width: 75px; display:none" onchange="initControlsWWRift();">';
  5926. preferenceHTMLStr += '<option value="25_0">0 Bar &ge; 25 Rage</option>';
  5927. preferenceHTMLStr += '<option value="25_1">1 Bar &ge; 25 Rage</option>';
  5928. preferenceHTMLStr += '<option value="25_2">2 Bars &ge; 25 Rage</option>';
  5929. preferenceHTMLStr += '<option value="44_0">3 Bars &ge; 25 Rage / 0 Bar &ge; 44 Rage</option>';
  5930. preferenceHTMLStr += '<option value="44_1">1 Bar &ge; 44 Rage</option>';
  5931. preferenceHTMLStr += '<option value="44_2">2 Bars &ge; 44 Rage</option>';
  5932. preferenceHTMLStr += '<option value="44_3">3 Bars &ge; 44 Rage / 0 Bar &ge; Min Rage to Hunt MBW</option>';
  5933. preferenceHTMLStr += '<option value="MIN_RAGE_1">1 Bar &ge; Min Rage to Hunt MBW</option>';
  5934. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5935. preferenceHTMLStr += '</td>';
  5936. preferenceHTMLStr += '<td style="height:24px">';
  5937. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapWeapon" onchange="saveWWRift();">';
  5938. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  5939. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5940. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5941. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5942. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  5943. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5944. preferenceHTMLStr += '</select>';
  5945. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapBase" style="width: 75px" onchange="saveWWRift();">';
  5946. preferenceHTMLStr += '</select>';
  5947. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapTrinket" style="width: 75px" onchange="saveWWRift();">';
  5948. preferenceHTMLStr += '<option value="None">None</option>';
  5949. preferenceHTMLStr += '<option value="FSCLR">Faction Specific Charm (Lowest Rage)</option>';
  5950. preferenceHTMLStr += '</select>';
  5951. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapBait" onchange="saveWWRift();">';
  5952. preferenceHTMLStr += '<option value="None">None</option>';
  5953. preferenceHTMLStr += '<option value="Lactrodectus Lancashire">LLC</option>';
  5954. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5955. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5956. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5957. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5958. preferenceHTMLStr += '</select>';
  5959. preferenceHTMLStr += '</td>';
  5960. preferenceHTMLStr += '</tr>';
  5961.  
  5962. preferenceHTMLStr += '<tr id="trFREnterBattery" style="display:none;">';
  5963. 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>';
  5964. preferenceHTMLStr += '<td style="height:24px">';
  5965. preferenceHTMLStr += '<select id="selectEnterAtBattery" onchange="saveFR();">';
  5966. preferenceHTMLStr += '<option value="None">None</option>';
  5967. for(i=1;i<=10;i++)
  5968. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5969. preferenceHTMLStr += '</select>';
  5970. preferenceHTMLStr += '</td>';
  5971. preferenceHTMLStr += '</tr>';
  5972.  
  5973. preferenceHTMLStr += '<tr id="trFRRetreatBattery" style="display:none;">';
  5974. 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>';
  5975. preferenceHTMLStr += '<td style="height:24px">';
  5976. preferenceHTMLStr += '<select id="selectRetreatAtBattery" onchange="saveFR();">';
  5977. for(i=0;i<=10;i++)
  5978. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5979. preferenceHTMLStr += '</select>';
  5980. preferenceHTMLStr += '</td>';
  5981. preferenceHTMLStr += '</tr>';
  5982.  
  5983. preferenceHTMLStr += '<tr id="trFRTrapSetupAtBattery" style="display:none;">';
  5984. 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;';
  5985. preferenceHTMLStr += '<select id="selectTrapSetupAtBattery" onchange="initControlsFR();">';
  5986. for(i=0;i<=10;i++)
  5987. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5988. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5989. preferenceHTMLStr += '</td>';
  5990. preferenceHTMLStr += '<td style="height:24px">';
  5991. preferenceHTMLStr += '<select id="selectFRTrapWeapon" onchange="saveFR();">';
  5992. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  5993. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5994. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5995. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5996. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  5997. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5998. preferenceHTMLStr += '</select>';
  5999. preferenceHTMLStr += '<select id="selectFRTrapBase" onchange="saveFR();">';
  6000. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  6001. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  6002. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  6003. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  6004. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  6005. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  6006. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  6007. preferenceHTMLStr += '</select>';
  6008. preferenceHTMLStr += '<select id="selectFRTrapTrinket" style="width: 75px" onchange="saveFR();">';
  6009. preferenceHTMLStr += '<option value="None">None</option>';
  6010. preferenceHTMLStr += '</select>';
  6011. preferenceHTMLStr += '<select id="selectFRTrapBait" style="width: 75px" onchange="onSelectFRTrapBait();">';
  6012. preferenceHTMLStr += '<option value="None">None</option>';
  6013. preferenceHTMLStr += '<option value="Ascended">Ascended</option>';
  6014. preferenceHTMLStr += '<option value="Null Onyx Gorgonzola">Null Onyx Gorgonzola</option>';
  6015. preferenceHTMLStr += '<option value="Rift Rumble">Rift Rumble</option>';
  6016. preferenceHTMLStr += '<option value="Rift Glutter">Rift Glutter</option>';
  6017. preferenceHTMLStr += '<option value="Rift Susheese">Rift Susheese</option>';
  6018. preferenceHTMLStr += '<option value="Rift Combat">Rift Combat</option>';
  6019. preferenceHTMLStr += '<option value="ANY_MASTER">Glutter/Combat/Susheese</option>';
  6020. preferenceHTMLStr += '<option value="BALANCE_MASTER">Balance Heirloom</option>';
  6021. preferenceHTMLStr += '<option value="ORDER_MASTER">Master Cheese in Order</option>';
  6022. preferenceHTMLStr += '<option value="Master Fusion">Master Fusion</option>';
  6023. preferenceHTMLStr += '<option value="Maki String">Maki</option>';
  6024. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  6025. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  6026. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  6027. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  6028. preferenceHTMLStr += '</select>';
  6029. preferenceHTMLStr += '<select id="selectFRTrapBaitMasterOrder" style="width: 75px;display:none" onchange="saveFR();">';
  6030. preferenceHTMLStr += '<option value="Glutter=>Combat=>Susheese">Glutter=>Combat=>Susheese</option>';
  6031. preferenceHTMLStr += '<option value="Glutter=>Susheese=>Combat">Glutter=>Susheese=>Combat</option>';
  6032. preferenceHTMLStr += '<option value="Combat=>Glutter=>Susheese">Combat=>Glutter=>Susheese</option>';
  6033. preferenceHTMLStr += '<option value="Combat=>Susheese=>Glutter">Combat=>Susheese=>Glutter</option>';
  6034. preferenceHTMLStr += '<option value="Susheese=>Glutter=>Combat">Susheese=>Glutter=>Combat</option>';
  6035. preferenceHTMLStr += '<option value="Susheese=>Combat=>Glutter">Susheese=>Combat=>Glutter</option>';
  6036. preferenceHTMLStr += '</select>';
  6037. preferenceHTMLStr += '</td>';
  6038. preferenceHTMLStr += '</tr>';
  6039.  
  6040. preferenceHTMLStr += '<tr id="trIceberg" style="display:none;">';
  6041. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to trap setup based on current phase"><b>Trap Setup for</b></a>';
  6042. preferenceHTMLStr += '<select id="selectIcebergPhase" style="width: 75px" onchange="initControlsIceberg();">';
  6043. preferenceHTMLStr += '<option value="GENERAL">Iceberg General</option>';
  6044. preferenceHTMLStr += '<option value="TREACHEROUS">Treacherous Tunnels</option>';
  6045. preferenceHTMLStr += '<option value="BRUTAL">Brutal Bulwark</option>';
  6046. preferenceHTMLStr += '<option value="BOMBING">Bombing Run</option>';
  6047. preferenceHTMLStr += '<option value="MAD">Mad Depths</option>';
  6048. preferenceHTMLStr += '<option value="ICEWING">Icewing\'s Lair</option>';
  6049. preferenceHTMLStr += '<option value="HIDDEN">Hidden Depths</option>';
  6050. preferenceHTMLStr += '<option value="DEEP">The Deep Lair</option>';
  6051. preferenceHTMLStr += '<option value="SLUSHY">Slushy Shoreline</option>';
  6052. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6053. preferenceHTMLStr += '</td>';
  6054. preferenceHTMLStr += '<td style="height:24px">';
  6055. preferenceHTMLStr += '<select id="selectIcebergBase" style="width: 75px" onchange="saveIceberg();">';
  6056. preferenceHTMLStr += '</select>';
  6057. preferenceHTMLStr += '<select id="selectIcebergTrinket" style="width: 75px" onchange="saveIceberg();">';
  6058. preferenceHTMLStr += '<option value="None">None</option>';
  6059. preferenceHTMLStr += '</select>';
  6060. preferenceHTMLStr += '<select id="selectIcebergBait" style="width: 75px" onchange="saveIceberg();">';
  6061. preferenceHTMLStr += '<option value="None">None</option>';
  6062. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6063. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6064. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6065. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6066. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6067. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6068. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6069. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6070. preferenceHTMLStr += '</select>';
  6071. preferenceHTMLStr += '</td>';
  6072. preferenceHTMLStr += '</tr>';
  6073.  
  6074. preferenceHTMLStr += '<tr id="trZTFocus" style="display:none;">';
  6075. 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>';
  6076. preferenceHTMLStr += '<td style="height:24px">';
  6077. preferenceHTMLStr += '<select id="selectZTFocus" onchange="saveZT();">';
  6078. preferenceHTMLStr += '<option value="MYSTIC">Mystic Only</option>';
  6079. preferenceHTMLStr += '<option value="TECHNIC">Technic Only</option>';
  6080. preferenceHTMLStr += '<option value="MYSTIC=>TECHNIC">Mystic First Technic Second</option>';
  6081. preferenceHTMLStr += '<option value="TECHNIC=>MYSTIC">Technic First Mystic Second</option>';
  6082. preferenceHTMLStr += '</select>';
  6083. preferenceHTMLStr += '</td>';
  6084. preferenceHTMLStr += '</tr>';
  6085. preferenceHTMLStr += '<tr id="trZTTrapSetup1st" style="display:none;">';
  6086. 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>';
  6087. preferenceHTMLStr += '<select id="selectZTMouseOrder1st" onchange="initControlsZT();">';
  6088. preferenceHTMLStr += '<option value="PAWN">Pawn</option>';
  6089. preferenceHTMLStr += '<option value="KNIGHT">Knight</option>';
  6090. preferenceHTMLStr += '<option value="BISHOP">Bishop</option>';
  6091. preferenceHTMLStr += '<option value="ROOK">Rook</option>';
  6092. preferenceHTMLStr += '<option value="QUEEN">Queen</option>';
  6093. preferenceHTMLStr += '<option value="KING">King</option>';
  6094. preferenceHTMLStr += '<option value="CHESSMASTER">Chessmaster</option>';
  6095. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6096. preferenceHTMLStr += '</td>';
  6097. preferenceHTMLStr += '<td style="height:24px">';
  6098. preferenceHTMLStr += '<select id="selectZTWeapon1st" style="width: 75px" onchange="saveZT();">';
  6099. preferenceHTMLStr += '<option value="MPP/TPP">Focused-Side Pawn Pincher</option>';
  6100. preferenceHTMLStr += '<option value="BPT/OAT">Focused-Side Trap BPT/OAT</option>';
  6101. preferenceHTMLStr += '</select>';
  6102. preferenceHTMLStr += '<select id="selectZTBase1st" style="width: 75px" onchange="saveZT();">';
  6103. preferenceHTMLStr += '</select>';
  6104. preferenceHTMLStr += '<select id="selectZTTrinket1st" style="width: 75px" onchange="saveZT();">';
  6105. preferenceHTMLStr += '<option value="None">None</option>';
  6106. preferenceHTMLStr += '</select>';
  6107. preferenceHTMLStr += '<select id="selectZTBait1st" style="width: 75px" onchange="saveZT();">';
  6108. preferenceHTMLStr += '<option value="None">None</option>';
  6109. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6110. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6111. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6112. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6113. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6114. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6115. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6116. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6117. preferenceHTMLStr += '<option value="Checkmate">Checkmate</option>';
  6118. preferenceHTMLStr += '</select>';
  6119. preferenceHTMLStr += '</td>';
  6120. preferenceHTMLStr += '</tr>';
  6121. preferenceHTMLStr += '<tr id="trZTTrapSetup2nd" style="display:none;">';
  6122. 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>';
  6123. preferenceHTMLStr += '<select id="selectZTMouseOrder2nd" onchange="initControlsZT();">';
  6124. preferenceHTMLStr += '<option value="PAWN">Pawn</option>';
  6125. preferenceHTMLStr += '<option value="KNIGHT">Knight</option>';
  6126. preferenceHTMLStr += '<option value="BISHOP">Bishop</option>';
  6127. preferenceHTMLStr += '<option value="ROOK">Rook</option>';
  6128. preferenceHTMLStr += '<option value="QUEEN">Queen</option>';
  6129. preferenceHTMLStr += '<option value="KING">King</option>';
  6130. preferenceHTMLStr += '<option value="CHESSMASTER">Chessmaster</option>';
  6131. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6132. preferenceHTMLStr += '</td>';
  6133. preferenceHTMLStr += '<td style="height:24px">';
  6134. preferenceHTMLStr += '<select id="selectZTWeapon2nd" style="width: 75px" onchange="saveZT();">';
  6135. preferenceHTMLStr += '<option value="MPP/TPP">Focused-Side Pawn Pincher</option>';
  6136. preferenceHTMLStr += '<option value="BPT/OAT">Focused-Side Trap BPT/OAT</option>';
  6137. preferenceHTMLStr += '</select>';
  6138. preferenceHTMLStr += '<select id="selectZTBase2nd" style="width: 75px" onchange="saveZT();">';
  6139. preferenceHTMLStr += '</select>';
  6140. preferenceHTMLStr += '<select id="selectZTTrinket2nd" style="width: 75px" onchange="saveZT();">';
  6141. preferenceHTMLStr += '<option value="None">None</option>';
  6142. preferenceHTMLStr += '</select>';
  6143. preferenceHTMLStr += '<select id="selectZTBait2nd" style="width: 75px" onchange="saveZT();">';
  6144. preferenceHTMLStr += '<option value="None">None</option>';
  6145. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6146. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6147. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6148. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6149. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6150. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6151. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6152. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6153. preferenceHTMLStr += '<option value="Checkmate">Checkmate</option>';
  6154. preferenceHTMLStr += '</select>';
  6155. preferenceHTMLStr += '</td>';
  6156. preferenceHTMLStr += '</tr>';
  6157.  
  6158. preferenceHTMLStr += '<tr id="trSGTrapSetup" style="display:none;">';
  6159. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to trap setup based on certain season"><b>Trap Setup For </b></a>';
  6160. preferenceHTMLStr += '<select id="selectSGSeason" onchange="initControlsSG();">';
  6161. preferenceHTMLStr += '<option value="SPRING">Spring</option>';
  6162. preferenceHTMLStr += '<option value="SUMMER">Summer</option>';
  6163. preferenceHTMLStr += '<option value="FALL">Fall</option>';
  6164. preferenceHTMLStr += '<option value="WINTER">Winter</option>';
  6165. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6166. preferenceHTMLStr += '</td>';
  6167. preferenceHTMLStr += '<td style="height:24px">';
  6168. preferenceHTMLStr += '<select id="selectSGTrapWeapon" style="width: 75px" onchange="saveSG();">';
  6169. preferenceHTMLStr += '</select>';
  6170. preferenceHTMLStr += '<select id="selectSGTrapBase" style="width: 75px" onchange="saveSG();">';
  6171. preferenceHTMLStr += '</select>';
  6172. preferenceHTMLStr += '<select id="selectSGTrapTrinket" style="width: 75px" onchange="saveSG();">';
  6173. preferenceHTMLStr += '<option value="None">None</option>';
  6174. preferenceHTMLStr += '</select>';
  6175. preferenceHTMLStr += '<select id="selectSGTrapBait" style="width: 75px" onchange="saveSG();">';
  6176. preferenceHTMLStr += '<option value="None">None</option>';
  6177. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6178. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6179. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6180. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6181. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6182. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6183. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6184. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6185. preferenceHTMLStr += '</select>';
  6186. preferenceHTMLStr += '</td>';
  6187. preferenceHTMLStr += '</tr>';
  6188.  
  6189. preferenceHTMLStr += '<tr id="trSGDisarmBait" style="display:none;">';
  6190. 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>';
  6191. preferenceHTMLStr += '<td style="height:24px">';
  6192. preferenceHTMLStr += '<select id="selectSGDisarmBait" onchange="saveSG();">';
  6193. preferenceHTMLStr += '<option value="false">False</option>';
  6194. preferenceHTMLStr += '<option value="true">True</option>';
  6195. preferenceHTMLStr += '</select>&nbsp;&nbsp;After Amplifier Fully Charged';
  6196. preferenceHTMLStr += '</td>';
  6197. preferenceHTMLStr += '</tr>';
  6198.  
  6199. preferenceHTMLStr += '<tr id="trLGTGAutoFill" style="display:none;">';
  6200. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Auto Fill in </b></a>';
  6201. preferenceHTMLStr += '<select id="selectLGTGAutoFillSide" onchange="initControlsLG();">';
  6202. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6203. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6204. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6205. preferenceHTMLStr += '</td>';
  6206. preferenceHTMLStr += '<td style="height:24px">';
  6207. preferenceHTMLStr += '<select id="selectLGTGAutoFillState" onchange="saveLG();">';
  6208. preferenceHTMLStr += '<option value="false">False</option>';
  6209. preferenceHTMLStr += '<option value="true">True</option>';
  6210. preferenceHTMLStr += '</select>';
  6211. preferenceHTMLStr += '</td>';
  6212. preferenceHTMLStr += '</tr>';
  6213. preferenceHTMLStr += '<tr id="trLGTGAutoPour" style="display:none;">';
  6214. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Auto Pour in </b></a>';
  6215. preferenceHTMLStr += '<select id="selectLGTGAutoPourSide" onchange="initControlsLG();">';
  6216. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6217. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6218. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6219. preferenceHTMLStr += '</td>';
  6220. preferenceHTMLStr += '<td style="height:24px">';
  6221. preferenceHTMLStr += '<select id="selectLGTGAutoPourState" onchange="saveLG();">';
  6222. preferenceHTMLStr += '<option value="false">False</option>';
  6223. preferenceHTMLStr += '<option value="true">True</option>';
  6224. preferenceHTMLStr += '</select>';
  6225. preferenceHTMLStr += '</td>';
  6226. preferenceHTMLStr += '</tr>';
  6227. preferenceHTMLStr += '<tr id="trPourTrapSetup" style="display:none;">';
  6228. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>After Poured in </b></a>';
  6229. preferenceHTMLStr += '<select id="selectLGTGSide" onchange="initControlsLG();">';
  6230. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6231. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6232. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6233. preferenceHTMLStr += '</td>';
  6234. preferenceHTMLStr += '<td style="height:24px">';
  6235. preferenceHTMLStr += '<select id="selectLGTGBase" style="width: 75px" onchange="saveLG();">';
  6236. preferenceHTMLStr += '</select>';
  6237. preferenceHTMLStr += '<select id="selectLGTGTrinket" style="width: 75px" onchange="saveLG();">';
  6238. preferenceHTMLStr += '<option value="None">None</option>';
  6239. preferenceHTMLStr += '</select>';
  6240. preferenceHTMLStr += '<select id="selectLGTGBait" style="width: 75px" onchange="saveLG();">';
  6241. preferenceHTMLStr += '<option value="None">None</option>';
  6242. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6243. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6244. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6245. preferenceHTMLStr += '<option value="Duskshade Camembert">Duskshade Camembert</option>';
  6246. preferenceHTMLStr += '<option value="Lunaria Camembert">Lunaria Camembert</option>';
  6247. preferenceHTMLStr += '</select>';
  6248. preferenceHTMLStr += '</td>';
  6249. preferenceHTMLStr += '</tr>';
  6250. preferenceHTMLStr += '<tr id="trCurseLiftedTrapSetup" style="display:none;">';
  6251. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>After Curse Lifted in </b></a>';
  6252. preferenceHTMLStr += '<select id="selectLCCCSide" onchange="initControlsLG();">';
  6253. preferenceHTMLStr += '<option value="LC">Lost City</option>';
  6254. preferenceHTMLStr += '<option value="CC">Cursed City</option>';
  6255. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6256. preferenceHTMLStr += '</td>';
  6257. preferenceHTMLStr += '<td style="height:24px">';
  6258. preferenceHTMLStr += '<select id="selectLCCCBase" style="width: 75px" onchange="saveLG();">';
  6259. preferenceHTMLStr += '</select>';
  6260. preferenceHTMLStr += '<select id="selectLCCCTrinket" style="width: 75px" onchange="saveLG();">';
  6261. preferenceHTMLStr += '<option value="None">None</option>';
  6262. preferenceHTMLStr += '</select>';
  6263. preferenceHTMLStr += '</td>';
  6264. preferenceHTMLStr += '</tr>';
  6265. preferenceHTMLStr += '<tr id="trSaltedTrapSetup" style="display:none;">';
  6266. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup </b></a>';
  6267. preferenceHTMLStr += '<select id="selectSaltedStatus" onchange="initControlsLG();">';
  6268. preferenceHTMLStr += '<option value="before">During</option>';
  6269. preferenceHTMLStr += '<option value="after">After</option>';
  6270. preferenceHTMLStr += '</select><a><b> Salt Charging</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6271. preferenceHTMLStr += '</td>';
  6272. preferenceHTMLStr += '<td style="height:24px">';
  6273. preferenceHTMLStr += '<select id="selectSCBase" style="width: 75px" onchange="saveLG();">';
  6274. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Max number of salt before hunting King Grub"><b>Salt Charge : </b></a>';
  6275. preferenceHTMLStr += '<input type="number" id="inputKGSalt" min="1" max="50" size="5" value="25" onchange="saveLG();">';
  6276. preferenceHTMLStr += '</td>';
  6277. preferenceHTMLStr += '</tr>';
  6278.  
  6279. preferenceHTMLStr += '<tr id="trGWHTrapSetup" style="display:none;">';
  6280. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on anchor/boost status"><b>Trap Setup When </b></a>';
  6281. preferenceHTMLStr += '<select id="selectGWHZone" style="width: 75px" onchange="initControlsGWH2016();">';
  6282. preferenceHTMLStr += '<option value="ORDER1">Simple Zone With Order</option>';
  6283. preferenceHTMLStr += '<option value="ORDER2">Deluxe Zone With Order</option>';
  6284. preferenceHTMLStr += '<option value="NONORDER1">Simple Zone W/O Order</option>';
  6285. preferenceHTMLStr += '<option value="NONORDER2">Deluxe Zone W/O Order</option>';
  6286. preferenceHTMLStr += '<option value="WINTER_WASTELAND">Winter Wasteland</option>';
  6287. preferenceHTMLStr += '<option value="SNOWBALL_STORM">Snowball Storm</option>';
  6288. preferenceHTMLStr += '<option value="FLYING">Flying</option>';
  6289. preferenceHTMLStr += '<option value="NEW_YEAR\'S_PARTY">New Year\'s Party</option>';
  6290. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6291. preferenceHTMLStr += '</td>';
  6292. preferenceHTMLStr += '<td style="height:24px">';
  6293. preferenceHTMLStr += '<select id="selectGWHWeapon" style="width: 75px" onchange="saveGWH2016();">';
  6294. preferenceHTMLStr += '</select>';
  6295. preferenceHTMLStr += '<select id="selectGWHBase" style="width: 75px" onchange="saveGWH2016();">';
  6296. preferenceHTMLStr += '</select>';
  6297. preferenceHTMLStr += '<select id="selectGWHTrinket" style="width: 75px;" onchange="onSelectGWHTrinketChanged();">';
  6298. preferenceHTMLStr += '<option value="None">None</option>';
  6299. preferenceHTMLStr += '<option value="ANCHOR_FAC/EAC">FAC/EAC</option>';
  6300. preferenceHTMLStr += '</select>';
  6301. preferenceHTMLStr += '<select id="selectGWHBait" style="width: 75px" onchange="saveGWH2016();">';
  6302. preferenceHTMLStr += '<option value="None">None</option>';
  6303. preferenceHTMLStr += '<option value="ANY_FESTIVE_BRIE">AA/Festive Cheese/Brie</option>';
  6304. preferenceHTMLStr += '<option value="ANY_FESTIVE_GOUDA">AA/Festive Cheese/Gouda</option>';
  6305. preferenceHTMLStr += '<option value="ANY_FESTIVE_SB">AA/Festive Cheese/SUPER|brie+</option>';
  6306. preferenceHTMLStr += '</select>';
  6307. preferenceHTMLStr += '<select id="selectGWHBoost" style="width: 75px" onchange="saveGWH2016();">';
  6308. preferenceHTMLStr += '<option value="false">Not Boost</option>';
  6309. preferenceHTMLStr += '<option value="true">Boost</option>';
  6310. preferenceHTMLStr += '</select>';
  6311. preferenceHTMLStr += '</td>';
  6312. preferenceHTMLStr += '</tr>';
  6313. preferenceHTMLStr += '<tr id="trGWHTurboBoost" style="display:none;">';
  6314. 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>';
  6315. preferenceHTMLStr += '<td style="height:24px">';
  6316. preferenceHTMLStr += '<select id="selectGWHUseTurboBoost" onchange="saveGWH2016();">';
  6317. preferenceHTMLStr += '<option value="false">False</option>';
  6318. preferenceHTMLStr += '<option value="true">True</option>';
  6319. preferenceHTMLStr += '</select>';
  6320. preferenceHTMLStr += '</td>';
  6321. preferenceHTMLStr += '</tr>';
  6322. preferenceHTMLStr += '<tr id="trGWHFlying" style="display:none;">';
  6323. 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>';
  6324. preferenceHTMLStr += '<td style="height:24px">';
  6325. preferenceHTMLStr += '<input type="number" id="inputMinAA" min="0" max="9007199254740991" style="width:50px" value="20" onchange="onInputMinAAChanged(this);">';
  6326. preferenceHTMLStr += '</td>';
  6327. preferenceHTMLStr += '</tr>';
  6328. preferenceHTMLStr += '<tr id="trGWHFlyingFirework" style="display:none;">';
  6329. 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>';
  6330. preferenceHTMLStr += '<td style="height:24px">';
  6331. preferenceHTMLStr += '<input type="number" id="inputMinFirework" min="0" max="9007199254740991" style="width:50px" value="20" onchange="onInputMinWorkChanged(this);">';
  6332. preferenceHTMLStr += '</td>';
  6333. preferenceHTMLStr += '</tr>';
  6334. preferenceHTMLStr += '<tr id="trGWHFlyingLand" style="display:none;">';
  6335. 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>';
  6336. preferenceHTMLStr += '<td style="height:24px">';
  6337. preferenceHTMLStr += '<select id="selectGWHLandAfterRunOutFirework" onchange="saveGWH2016();">';
  6338. preferenceHTMLStr += '<option value="false">False</option>';
  6339. preferenceHTMLStr += '<option value="true">True</option>';
  6340. preferenceHTMLStr += '</select>';
  6341. preferenceHTMLStr += '</td>';
  6342. preferenceHTMLStr += '</tr>';
  6343.  
  6344. preferenceHTMLStr += '<tr id="trSCCustom" style="display:none;">';
  6345. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6346. preferenceHTMLStr += '<a title="Select custom algorithm"><b>SC Custom Algorithm</b></a>';
  6347. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6348. preferenceHTMLStr += '</td>';
  6349. preferenceHTMLStr += '<td style="height:24px">';
  6350. preferenceHTMLStr += '<select id="selectSCHuntZone" style="width:75px" onChange="initControlsSCCustom();">';
  6351. preferenceHTMLStr += '<option value="ZONE_NOT_DIVE">Surface</option>';
  6352. preferenceHTMLStr += '<option value="ZONE_DEFAULT">Default</option>';
  6353. preferenceHTMLStr += '<option value="ZONE_CORAL">Coral</option>';
  6354. preferenceHTMLStr += '<option value="ZONE_SCALE">Scale</option>';
  6355. preferenceHTMLStr += '<option value="ZONE_BARNACLE">Barnacle</option>';
  6356. preferenceHTMLStr += '<option value="ZONE_TREASURE">Treasure</option>';
  6357. preferenceHTMLStr += '<option value="ZONE_DANGER">Danger</option>';
  6358. preferenceHTMLStr += '<option value="ZONE_DANGER_PP">Danger PP MT</option>';
  6359. preferenceHTMLStr += '<option value="ZONE_DANGER_PP_LOTA">Danger PP LOTA</option>';
  6360. preferenceHTMLStr += '<option value="ZONE_OXYGEN">Oxygen</option>';
  6361. preferenceHTMLStr += '<option value="ZONE_BONUS">Bonus</option>';
  6362. preferenceHTMLStr += '</select>';
  6363. preferenceHTMLStr += '<select id="selectSCHuntZoneEnable" style="width:75px;display:none" onChange="saveSCCustomAlgo();">';
  6364. preferenceHTMLStr += '<option value="true">Hunt</option>';
  6365. preferenceHTMLStr += '<option value="false">Jet Through</option>';
  6366. preferenceHTMLStr += '</select>';
  6367. preferenceHTMLStr += '<select id="selectSCHuntBait" style="width: 75px" onchange="saveSCCustomAlgo();">';
  6368. preferenceHTMLStr += '<option value="None">None</option>';
  6369. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6370. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6371. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6372. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6373. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6374. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6375. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6376. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6377. preferenceHTMLStr += '<option value="Fishy Fromage">Fishy Fromage</option>';
  6378. preferenceHTMLStr += '</select>';
  6379. preferenceHTMLStr += '<select id="selectSCHuntTrinket" style="width: 75px" onchange="saveSCCustomAlgo();">';
  6380. preferenceHTMLStr += '<option value="None">None</option>';
  6381. preferenceHTMLStr += '<option value="Empowered Anchor">EAC</option>';
  6382. preferenceHTMLStr += '<option value="GAC_EAC">GAC, EAC</option>';
  6383. preferenceHTMLStr += '<option value="SAC_EAC">SAC, EAC</option>';
  6384. preferenceHTMLStr += '<option value="UAC_EAC">UAC, EAC</option>';
  6385. preferenceHTMLStr += '</select>';
  6386. preferenceHTMLStr += '</td>';
  6387. preferenceHTMLStr += '</tr>';
  6388.  
  6389. preferenceHTMLStr += '<tr id="trSCCustomUseSmartJet" style="display:none;">';
  6390. 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>';
  6391. preferenceHTMLStr += '<td style="height:24px">';
  6392. preferenceHTMLStr += '<select id="selectSCUseSmartJet" onchange="saveSCCustomAlgo();">';
  6393. preferenceHTMLStr += '<option value="false">False</option>';
  6394. preferenceHTMLStr += '<option value="true">True</option>';
  6395. preferenceHTMLStr += '</select>';
  6396. preferenceHTMLStr += '</td>';
  6397. preferenceHTMLStr += '</tr>';
  6398.  
  6399. preferenceHTMLStr += '<tr id="trLabyrinth" style="display:none;">';
  6400. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6401. preferenceHTMLStr += '<a title="Select a district to focus on"><b>District to Focus</b></a>';
  6402. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6403. preferenceHTMLStr += '</td>';
  6404. preferenceHTMLStr += '<td style="height:24px">';
  6405. preferenceHTMLStr += '<select id="selectLabyrinthDistrict" onChange="onSelectLabyrinthDistrict();">';
  6406. preferenceHTMLStr += '<option value="None">None</option>';
  6407. preferenceHTMLStr += '<option value="FEALTY">Fealty</option>';
  6408. preferenceHTMLStr += '<option value="TECH">Tech</option>';
  6409. preferenceHTMLStr += '<option value="SCHOLAR">Scholar</option>';
  6410. preferenceHTMLStr += '<option value="TREASURY">Treasury</option>';
  6411. preferenceHTMLStr += '<option value="FARMING">Farming</option>';
  6412. preferenceHTMLStr += '</select>';
  6413. preferenceHTMLStr += '</td>';
  6414. preferenceHTMLStr += '</tr>';
  6415.  
  6416. preferenceHTMLStr += '<tr id="trLabyrinthDisarm" style="display:none;">';
  6417. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6418. preferenceHTMLStr += '<a title="Select to disarm cheese at X last hunt in hallway when total clues near 100"><b>Security Disarm</b></a>';
  6419. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6420. preferenceHTMLStr += '</td>';
  6421. preferenceHTMLStr += '<td style="height:24px">';
  6422. preferenceHTMLStr += '<select id="selectLabyrinthDisarm" onChange="onSelectLabyrinthDisarm();">';
  6423. preferenceHTMLStr += '<option value="false">False</option>';
  6424. preferenceHTMLStr += '<option value="true">True</option>';
  6425. preferenceHTMLStr += '</select>&nbsp;&nbsp;At Last&nbsp;';
  6426. 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';
  6427. preferenceHTMLStr += '</td>';
  6428. preferenceHTMLStr += '</tr>';
  6429.  
  6430. preferenceHTMLStr += '<tr id="trLabyrinthArmOtherBase" style="display:none;">';
  6431. 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>';
  6432. preferenceHTMLStr += '<td style="height:24px">';
  6433. preferenceHTMLStr += '<select id="selectLabyrinthOtherBase" style="width: 75px" onchange="saveLaby();">';
  6434. preferenceHTMLStr += '<option value="false">False</option>';
  6435. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Compass Magnet Charm is armed';
  6436. preferenceHTMLStr += '</td>';
  6437. preferenceHTMLStr += '</tr>';
  6438.  
  6439. preferenceHTMLStr += '<tr id="trLabyrinthDisarmCompass" style="display:none;">';
  6440. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Disarm Compass Magnet</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6441. preferenceHTMLStr += '<td style="height:24px">';
  6442. preferenceHTMLStr += '<select id="selectLabyrinthDisarmCompass" onchange="onSelectLabyrinthDisarmCompass();">';
  6443. preferenceHTMLStr += '<option value="true">True</option>';
  6444. preferenceHTMLStr += '<option value="false">False</option>';
  6445. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Dead End Clue &le; :&nbsp;';
  6446. preferenceHTMLStr += '<input type="number" id="inputLabyrinthDEC" min="0" max="20" style="width:40px" value="0" onchange="onInputLabyrinthDECChanged(this);">';
  6447. preferenceHTMLStr += '</td>';
  6448. preferenceHTMLStr += '</tr>';
  6449.  
  6450. preferenceHTMLStr += '<tr id="trPriorities15" style="display:none;">';
  6451. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6452. 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;';
  6453. preferenceHTMLStr += '</td>';
  6454. preferenceHTMLStr += '<td style="height:24px">';
  6455. preferenceHTMLStr += '<select id="selectHallway15Plain" onChange="saveLaby();">';
  6456. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6457. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6458. preferenceHTMLStr += '</select>';
  6459. preferenceHTMLStr += '</td>';
  6460. preferenceHTMLStr += '</tr>';
  6461.  
  6462. preferenceHTMLStr += '<tr id="trPriorities1560" style="display:table-row;">';
  6463. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6464. 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>';
  6465. preferenceHTMLStr += '<td style="height:24px">';
  6466. preferenceHTMLStr += '<select id="selectHallway1560Superior" onchange="saveLaby();">';
  6467. preferenceHTMLStr += '<option value="ls">Long Superior Hallway First</option>';
  6468. preferenceHTMLStr += '<option value="ss">Short Superior Hallway First</option>';
  6469. preferenceHTMLStr += '</select>';
  6470. preferenceHTMLStr += '<select id="selectHallway1560Plain" onchange="saveLaby();">';
  6471. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6472. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6473. preferenceHTMLStr += '</select>';
  6474. preferenceHTMLStr += '</td>';
  6475. preferenceHTMLStr += '</tr>';
  6476.  
  6477. preferenceHTMLStr += '<tr id="trPriorities60" style="display:none;">';
  6478. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6479. 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>';
  6480. preferenceHTMLStr += '<td style="height:24px">';
  6481. preferenceHTMLStr += '<select id="selectHallway60Epic" onchange="saveLaby();">';
  6482. preferenceHTMLStr += '<option value="le">Long Epic Hallway First</option>';
  6483. preferenceHTMLStr += '<option value="se">Short Epic Hallway First</option>';
  6484. preferenceHTMLStr += '</select>';
  6485. preferenceHTMLStr += '<select id="selectHallway60Superior" onchange="saveLaby();">';
  6486. preferenceHTMLStr += '<option value="ls">Long Superior Hallway First</option>';
  6487. preferenceHTMLStr += '<option value="ss">Short Superior Hallway First</option>';
  6488. preferenceHTMLStr += '</select>';
  6489. preferenceHTMLStr += '<select id="selectHallway60Plain" onchange="saveLaby();">';
  6490. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6491. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6492. preferenceHTMLStr += '</select>';
  6493. preferenceHTMLStr += '</td>';
  6494. preferenceHTMLStr += '</tr>';
  6495.  
  6496. preferenceHTMLStr += '<tr id="trLabyrinthOtherHallway" style="display:none;">';
  6497. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6498. 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>';
  6499. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6500. preferenceHTMLStr += '</td>';
  6501. preferenceHTMLStr += '<td style="height:24px">';
  6502. preferenceHTMLStr += '<select id="chooseOtherDoors" onChange="\
  6503. saveLaby();\
  6504. document.getElementById(\'typeOtherDoors\').disabled = (value == \'false\') ? \'disabled\' : \'\'; ">';
  6505. preferenceHTMLStr += '<option value="false">False</option>';
  6506. preferenceHTMLStr += '<option value="true">True</option>';
  6507. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select a choosing type for non-focused doors"><b>Choosing Type:</b></a>&emsp;';
  6508. preferenceHTMLStr += '<select id="typeOtherDoors" onChange="saveLaby();">';
  6509. preferenceHTMLStr += '<option value="SHORTEST_ONLY">Shortest Length Only</option>';
  6510. preferenceHTMLStr += '<option value="FEWEST_ONLY">Fewest Clue Only</option>';
  6511. preferenceHTMLStr += '<option value="SHORTEST_FEWEST">Shortest Length => Fewest Clue</option>';
  6512. preferenceHTMLStr += '<option value="FEWEST_SHORTEST">Fewest Clue => Shortest Length </option>';
  6513. preferenceHTMLStr += '</select>';
  6514. preferenceHTMLStr += '</td>';
  6515. preferenceHTMLStr += '</tr>';
  6516.  
  6517. preferenceHTMLStr += '<tr id="trLabyrinthWeaponFarming" style="display:none;">';
  6518. 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>';
  6519. preferenceHTMLStr += '<td style="height:24px">';
  6520. preferenceHTMLStr += '<select id="selectLabyrinthWeaponType" onchange="saveLaby();">';
  6521. preferenceHTMLStr += '<option value="Forgotten">Forgotten</option>';
  6522. preferenceHTMLStr += '<option value="Arcane">Arcane</option>';
  6523. preferenceHTMLStr += '</select>';
  6524. preferenceHTMLStr += '</td>';
  6525. preferenceHTMLStr += '</tr>';
  6526.  
  6527. preferenceHTMLStr += '<tr id="trZokorTrapSetup" style="display:none;">';
  6528. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6529. preferenceHTMLStr += '<a title="Select trap setup under different boss status"><b>Trap Setup When</b></a>';
  6530. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6531. preferenceHTMLStr += '</td>';
  6532. preferenceHTMLStr += '<td style="height:24px">';
  6533. preferenceHTMLStr += '<select id="selectZokorBossStatus" onChange="initControlsZokor();">';
  6534. preferenceHTMLStr += '<option value="INCOMING">Boss Incoming</option>';
  6535. preferenceHTMLStr += '<option value="ACTIVE">Boss Active</option>';
  6536. preferenceHTMLStr += '<option value="DEFEATED">Boss Defeated</option>';
  6537. preferenceHTMLStr += '</select>&nbsp;&nbsp;';
  6538. preferenceHTMLStr += '<select id="selectZokorBait" style="width: 75px" onChange="saveZokor();">';
  6539. preferenceHTMLStr += '<option value="None">None</option>';
  6540. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6541. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6542. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6543. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6544. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6545. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6546. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6547. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6548. preferenceHTMLStr += '<option value="Glowing Gruyere">GG</option>';
  6549. preferenceHTMLStr += '</select>&nbsp;&nbsp;';
  6550. preferenceHTMLStr += '<select id="selectZokorTrinket" style="width: 75px" onChange="saveZokor();">';
  6551. preferenceHTMLStr += '<option value="None">None</option>';
  6552. preferenceHTMLStr += '</select>';
  6553. preferenceHTMLStr += '</td>';
  6554. preferenceHTMLStr += '</tr>';
  6555.  
  6556. preferenceHTMLStr += '<tr id="trFWWave" style="display:none;">';
  6557. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6558. preferenceHTMLStr += '<a title="Select FW wave"><b>Wave</b></a>';
  6559. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6560. preferenceHTMLStr += '</td>';
  6561. preferenceHTMLStr += '<td style="height:24px">';
  6562. preferenceHTMLStr += '<select id="selectFWWave" onChange="initControlsFW();">';
  6563. preferenceHTMLStr += '<option value="1">1</option>';
  6564. preferenceHTMLStr += '<option value="2">2</option>';
  6565. preferenceHTMLStr += '<option value="3">3</option>';
  6566. preferenceHTMLStr += '<option value="4">4</option>';
  6567. preferenceHTMLStr += '</select>';
  6568. preferenceHTMLStr += '</td>';
  6569. preferenceHTMLStr += '</tr>';
  6570.  
  6571. preferenceHTMLStr += '<tr id="trFWTrapSetup" style="display:none;">';
  6572. 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>';
  6573. preferenceHTMLStr += '<td style="height:24px">';
  6574. preferenceHTMLStr += '<select id="selectFWTrapSetupWeapon" style="width: 75px" onchange="saveFW();">';
  6575. preferenceHTMLStr += '</select>';
  6576. preferenceHTMLStr += '<select id="selectFWTrapSetupBase" style="width: 75px" onchange="saveFW();">';
  6577. preferenceHTMLStr += '</select>';
  6578. preferenceHTMLStr += '</td>';
  6579. preferenceHTMLStr += '</tr>';
  6580.  
  6581. preferenceHTMLStr += '<tr id="trFW4TrapSetup" style="display:none;">';
  6582. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on warden status"><b>Trap Setup </b></a>';
  6583. preferenceHTMLStr += '<select id="selectFW4WardenStatus" onchange="initControlsFW();">';
  6584. preferenceHTMLStr += '<option value="before">Before</option>';
  6585. preferenceHTMLStr += '<option value="after">After</option>';
  6586. preferenceHTMLStr += '</select><a><b> Clear Warden</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6587. preferenceHTMLStr += '</td>';
  6588. preferenceHTMLStr += '<td style="height:24px">';
  6589. preferenceHTMLStr += '<select id="selectFW4TrapSetupWeapon" style="width: 75px" onchange="saveFW();">';
  6590. preferenceHTMLStr += '</select>';
  6591. preferenceHTMLStr += '<select id="selectFW4TrapSetupBase" style="width: 75px" onchange="saveFW();">';
  6592. preferenceHTMLStr += '</select>';
  6593. preferenceHTMLStr += '<select id="selectFW4TrapSetupTrinket" style="width: 75px" onchange="saveFW();">';
  6594. preferenceHTMLStr += '<option value="None">None</option>';
  6595. preferenceHTMLStr += '</select>';
  6596. preferenceHTMLStr += '<select id="selectFW4TrapSetupBait" style="width: 75px" onchange="saveFW();">';
  6597. preferenceHTMLStr += '<option value="None">None</option>';
  6598. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6599. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6600. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6601. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6602. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6603. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6604. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6605. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6606. preferenceHTMLStr += '</select>';
  6607. preferenceHTMLStr += '</td>';
  6608. preferenceHTMLStr += '</tr>';
  6609.  
  6610. preferenceHTMLStr += '<tr id="trFWFocusType" style="display:none;">';
  6611. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6612. preferenceHTMLStr += '<a title="Select either Normal (Warrior, Scout, Archer) or Special (Cavalry, Mage)"><b>Soldier Type to Focus</b></a>';
  6613. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6614. preferenceHTMLStr += '</td>';
  6615. preferenceHTMLStr += '<td style="height:24px">';
  6616. preferenceHTMLStr += '<select id="selectFWFocusType" onChange="saveFW();">';
  6617. preferenceHTMLStr += '<option value="NORMAL">Normal</option>';
  6618. preferenceHTMLStr += '<option value="SPECIAL">Special</option>';
  6619. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select which soldier type comes first based on population"><b>Priorities:</b></a>&emsp;';
  6620. preferenceHTMLStr += '<select id="selectFWPriorities" onChange="saveFW();">';
  6621. preferenceHTMLStr += '<option value="HIGHEST">Highest Population First</option>';
  6622. preferenceHTMLStr += '<option value="LOWEST">Lowest Population First</option>';
  6623. preferenceHTMLStr += '</select>';
  6624. preferenceHTMLStr += '</td>';
  6625. preferenceHTMLStr += '</tr>';
  6626.  
  6627. preferenceHTMLStr += '<tr id="trFWStreak" style="display:none;">';
  6628. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6629. preferenceHTMLStr += '<a title="Select streak"><b>Streak</b></a>';
  6630. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6631. preferenceHTMLStr += '</td>';
  6632. preferenceHTMLStr += '<td style="height:24px">';
  6633. preferenceHTMLStr += '<select id="selectFWStreak" onChange="initControlsFW();">';
  6634. preferenceHTMLStr += '<option value="0">0</option>';
  6635. preferenceHTMLStr += '<option value="1">1</option>';
  6636. preferenceHTMLStr += '<option value="2">2</option>';
  6637. preferenceHTMLStr += '<option value="3">3</option>';
  6638. preferenceHTMLStr += '<option value="4">4</option>';
  6639. preferenceHTMLStr += '<option value="5">5</option>';
  6640. preferenceHTMLStr += '<option value="6">6</option>';
  6641. preferenceHTMLStr += '<option value="7">7</option>';
  6642. preferenceHTMLStr += '<option value="8">8</option>';
  6643. preferenceHTMLStr += '<option value="9">9</option>';
  6644. preferenceHTMLStr += '<option value="10">10</option>';
  6645. preferenceHTMLStr += '<option value="11">11</option>';
  6646. preferenceHTMLStr += '<option value="12">12</option>';
  6647. preferenceHTMLStr += '<option value="13">13</option>';
  6648. preferenceHTMLStr += '<option value="14">14</option>';
  6649. preferenceHTMLStr += '<option value="15">15</option>';
  6650. preferenceHTMLStr += '</select>';
  6651. preferenceHTMLStr += '<select id="selectFWCheese" style="width: 75px" onChange="saveFW();">';
  6652. preferenceHTMLStr += '<option value="None">None</option>';
  6653. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6654. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6655. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6656. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6657. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6658. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6659. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6660. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6661. preferenceHTMLStr += '</select>';
  6662. preferenceHTMLStr += '<select id="selectFWCharmType" style="width: 75px" onChange="saveFW();">';
  6663. preferenceHTMLStr += '<option value="None">None</option>';
  6664. preferenceHTMLStr += '<option value="Warpath">Warpath</option>';
  6665. preferenceHTMLStr += '<option value="Super Warpath">Super Warpath</option>';
  6666. preferenceHTMLStr += '</select>';
  6667. preferenceHTMLStr += '<select id="selectFWSpecial" style="width: 75px" onChange="saveFW();">';
  6668. preferenceHTMLStr += '<option value="None">None</option>';
  6669. preferenceHTMLStr += '<option value="COMMANDER">Commander</option>';
  6670. preferenceHTMLStr += '<option value="GARGANTUA">Gargantua</option>';
  6671. preferenceHTMLStr += '<option value="GARGANTUA_GGC" disabled="disabled">Gargantua GGC</option>';
  6672. preferenceHTMLStr += '</select>';
  6673. preferenceHTMLStr += '</td>';
  6674. preferenceHTMLStr += '</tr>';
  6675.  
  6676. preferenceHTMLStr += '<tr id="trFWLastType" style="display:none;">';
  6677. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6678. preferenceHTMLStr += '<a title="Select config when there is only one soldier type left"><b>Last Soldier Type</b></a>';
  6679. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6680. preferenceHTMLStr += '</td>';
  6681. preferenceHTMLStr += '<td style="height:24px;">';
  6682. preferenceHTMLStr += '<select id="selectFWLastTypeConfig" onChange="saveFW();">';
  6683. preferenceHTMLStr += '<option value="CONFIG_STREAK">Follow Streak Config</option>';
  6684. preferenceHTMLStr += '<option value="CONFIG_GOUDA">Gouda & No Warpath Charm</option>';
  6685. preferenceHTMLStr += '<option value="NO_WARPATH">No Warpath Charm Only</option>';
  6686. preferenceHTMLStr += '<option value="CONFIG_UNCHANGED">Trap Setup Unchanged</option>';
  6687. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select whether to include Artillery in checking of Last Soldier"><b>Include Artillery:</b></a>&emsp;';
  6688. preferenceHTMLStr += '<select id="selectFWLastTypeConfigIncludeArtillery" onchange="saveFW();">';
  6689. preferenceHTMLStr += '<option value="true">True</option>';
  6690. preferenceHTMLStr += '<option value="false">False</option>';
  6691. preferenceHTMLStr += '</select>';
  6692. preferenceHTMLStr += '</td>';
  6693. preferenceHTMLStr += '</tr>';
  6694.  
  6695. preferenceHTMLStr += '<tr id="trFWSupportConfig" style="display:none;">';
  6696. 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>';
  6697. preferenceHTMLStr += '<td style="height:24px">';
  6698. preferenceHTMLStr += '<select id="selectFWSupportConfig" onchange="saveFW();">';
  6699. preferenceHTMLStr += '<option value="false">False</option>';
  6700. preferenceHTMLStr += '<option value="true">True</option>';
  6701. preferenceHTMLStr += '</select>&nbsp;&nbsp;When Support Retreated';
  6702. preferenceHTMLStr += '</td>';
  6703. preferenceHTMLStr += '</tr>';
  6704.  
  6705. preferenceHTMLStr += '<tr id="trBRConfig" style="display:none;">';
  6706. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6707. preferenceHTMLStr += '<a title="Select the mist tier to hunt"><b>Hunt At</b></a>';
  6708. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6709. preferenceHTMLStr += '</td>';
  6710. preferenceHTMLStr += '<td style="height:24px;">';
  6711. preferenceHTMLStr += '<select id="selectBRHuntMistTier" onChange="onSelectBRHuntMistTierChanged();">';
  6712. preferenceHTMLStr += '<option value="Red">Red</option>';
  6713. preferenceHTMLStr += '<option value="Green">Green</option>';
  6714. preferenceHTMLStr += '<option value="Yellow">Yellow</option>';
  6715. preferenceHTMLStr += '<option value="None">None</option>';
  6716. preferenceHTMLStr += '</select>&nbsp;&nbsp;Mist Tier';
  6717. preferenceHTMLStr += '</td>';
  6718. preferenceHTMLStr += '</tr>';
  6719.  
  6720. preferenceHTMLStr += '<tr id="trBRToggle" style="display:none;">';
  6721. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6722. preferenceHTMLStr += '<a title="Select the amount of hunt to toggle canister"><b>Toggle Canister Every</b></a>';
  6723. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6724. preferenceHTMLStr += '</td>';
  6725. preferenceHTMLStr += '<td style="height:24px;">';
  6726. preferenceHTMLStr += '<input type="number" id="inputToggleCanister" min="1" max="999" value="1" onchange="onInputToggleCanisterChanged(this);">&nbsp;&nbsp;Hunt(s)';
  6727. preferenceHTMLStr += '</td>';
  6728. preferenceHTMLStr += '</tr>';
  6729.  
  6730. preferenceHTMLStr += '<tr id="trBRTrapSetup" style="display:none;">';
  6731. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6732. preferenceHTMLStr += '<a title="Select trap setup combination for respective mist tier"><b>Trap Setup</b></a>';
  6733. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6734. preferenceHTMLStr += '</td>';
  6735. preferenceHTMLStr += '<td style="height:24px;">';
  6736. preferenceHTMLStr += '<select id="selectBRTrapWeapon" onchange="saveBR();">';
  6737. preferenceHTMLStr += '<option value="Timesplit Dissonance Weapon">TDW</option>';
  6738. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  6739. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  6740. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  6741. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer Trap">BRT</option>';
  6742. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  6743. preferenceHTMLStr += '</select>';
  6744. preferenceHTMLStr += '<select id="selectBRTrapBase" style="width: 75px" onchange="saveBR();">';
  6745. preferenceHTMLStr += '</select>';
  6746. preferenceHTMLStr += '<select id="selectBRTrapTrinket" style="width: 75px" onchange="saveBR();">';
  6747. preferenceHTMLStr += '<option value="None">None</option>';
  6748. preferenceHTMLStr += '</select>';
  6749. preferenceHTMLStr += '<select id="selectBRTrapBait" onchange="saveBR();">';
  6750. preferenceHTMLStr += '<option value="None">None</option>';
  6751. preferenceHTMLStr += '<option value="Polluted Parmesan">PP</option>';
  6752. preferenceHTMLStr += '<option value="Terre Ricotta">Terre</option>';
  6753. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  6754. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  6755. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  6756. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  6757. preferenceHTMLStr += '<option value="Undead String Emmental">USE</option>';
  6758. preferenceHTMLStr += '</select>';
  6759. preferenceHTMLStr += '</td>';
  6760. preferenceHTMLStr += '</tr>';
  6761.  
  6762. preferenceHTMLStr += '<tr>';
  6763. preferenceHTMLStr += '<td style="height:24px; text-align:right;" colspan="2">';
  6764. 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;';
  6765. 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;';
  6766. preferenceHTMLStr += '</td>';
  6767. preferenceHTMLStr += '</tr>';
  6768. preferenceHTMLStr += '</table>';
  6769.  
  6770. var preferenceDiv = document.createElement('div');
  6771. preferenceDiv.setAttribute('id', 'preferenceDiv');
  6772. if (showPreference === true)
  6773. preferenceDiv.setAttribute('style', 'display: block');
  6774. else
  6775. preferenceDiv.setAttribute('style', 'display: none');
  6776. preferenceDiv.innerHTML = preferenceHTMLStr;
  6777. timerDivElement.appendChild(preferenceDiv);
  6778. preferenceHTMLStr = null;
  6779. showPreference = null;
  6780.  
  6781. var hr3Element = document.createElement('hr');
  6782. preferenceDiv.appendChild(hr3Element);
  6783. hr3Element = null;
  6784. preferenceDiv = null;
  6785.  
  6786. // embed all msg to the page
  6787. headerElement.parentNode.insertBefore(timerDivElement, headerElement);
  6788.  
  6789. timerDivElement = null;
  6790.  
  6791. var scriptElement = document.createElement("script");
  6792. scriptElement.setAttribute('type', "text/javascript");
  6793. scriptElement.setAttribute('id', "scriptUIFunction");
  6794. scriptElement.innerHTML = functionToHTMLString(bodyJS);
  6795. headerElement.parentNode.insertBefore(scriptElement, headerElement);
  6796. scriptElement = null;
  6797.  
  6798. addKREntries();
  6799. setKREntriesColor();
  6800.  
  6801. // insert trap list
  6802. var objSelectStr = {
  6803. weapon : ['selectWeapon','selectZTWeapon1st','selectZTWeapon2nd','selectBestTrapWeapon','selectFWTrapSetupWeapon','selectFW4TrapSetupWeapon','selectSGTrapWeapon','selectFRoxWeapon','selectGWHWeapon','selectBCJODWeapon','selectFGARWeapon'],
  6804. base : ['selectBase','selectLabyrinthOtherBase','selectZTBase1st','selectZTBase2nd','selectBestTrapBase','selectFWTrapSetupBase','selectFW4TrapSetupBase','selectLGTGBase','selectLCCCBase','selectSCBase', 'selectIcebergBase', 'selectGESTrapBase','selectSGTrapBase','selectFRoxBase','selectGWHBase','selectBRTrapBase','selectWWRiftTrapBase','selectWWRiftMBWTrapBase','selectBCJODBase','selectFGARBase'],
  6805. 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'],
  6806. bait : ['selectBait','selectGWHBait']
  6807. };
  6808. var temp;
  6809. var optionEle;
  6810. for (var prop in objTrapCollection) {
  6811. if(objTrapCollection.hasOwnProperty(prop)) {
  6812. objTrapCollection[prop] = objTrapCollection[prop].sort();
  6813. for(i=0;i<objTrapCollection[prop].length;i++){
  6814. optionEle = document.createElement("option");
  6815. optionEle.setAttribute('value', objTrapCollection[prop][i]);
  6816. optionEle.innerText = objTrapCollection[prop][i];
  6817. if(objSelectStr.hasOwnProperty(prop)){
  6818. for(var j=0;j<objSelectStr[prop].length;j++){
  6819. temp = document.getElementById(objSelectStr[prop][j]);
  6820. if(!isNullOrUndefined(temp))
  6821. temp.appendChild(optionEle.cloneNode(true));
  6822. }
  6823. }
  6824. }
  6825. }
  6826. }
  6827. document.getElementById('idRestore').style.display = (targetPage) ? 'table-row' : 'none';
  6828. document.getElementById('idGetLogAndPreference').style.display = (targetPage) ? 'table-row' : 'none';
  6829. document.getElementById('clearTrapList').style.display = (targetPage) ? 'table-row' : 'none';
  6830. document.getElementById('showPreferenceLink').style.display = (targetPage) ? 'table-row' : 'none';
  6831. }
  6832. headerElement = null;
  6833. }
  6834. targetPage = null;
  6835. }
  6836.  
  6837. function addKREntries(){
  6838. var i,temp,maxLen,keyName;
  6839. var replaced = "";
  6840. var nTimezoneOffset = -(new Date().getTimezoneOffset()) * 60000;
  6841. var count = 1;
  6842. var strInnerHTML = '';
  6843. var selectViewKR = document.getElementById('viewKR');
  6844. if(selectViewKR.options.length > 0){
  6845. // append keyKR for new KR entries under new UI
  6846. for(i = 0; i<window.localStorage.length;i++){
  6847. keyName = window.localStorage.key(i);
  6848. if(keyName.indexOf("KR" + separator) > -1 && keyKR.indexOf(keyName) < 0)
  6849. keyKR.push(keyName);
  6850. }
  6851. }
  6852. maxLen = keyKR.length.toString().length;
  6853. for(i=0;i<keyKR.length;i++){
  6854. if (keyKR[i].indexOf("KR" + separator) > -1){
  6855. temp = keyKR[i].split(separator);
  6856. temp.splice(0,1);
  6857. temp[0] = parseInt(temp[0]);
  6858. if (Number.isNaN(temp[0]))
  6859. temp[0] = 0;
  6860.  
  6861. temp[0] += nTimezoneOffset;
  6862. temp[0] = (new Date(temp[0])).toISOString();
  6863. replaced = temp.join("&nbsp;&nbsp;");
  6864. temp = count.toString();
  6865. while(temp.length < maxLen){
  6866. temp = '0' + temp;
  6867. }
  6868. replaced = temp + '. ' + replaced;
  6869. strInnerHTML += '<option value="' + keyKR[i] +'"' + ((i == keyKR.length - 1) ? ' selected':'') + '>' + replaced +'</option>';
  6870. count++;
  6871. }
  6872. }
  6873. if(strInnerHTML !== '')
  6874. selectViewKR.innerHTML = strInnerHTML;
  6875. }
  6876.  
  6877. function setKREntriesColor(){
  6878. // set KR entries color
  6879. var i, nCurrent, nNext, strCurrent;
  6880. var selectViewKR = document.getElementById('viewKR');
  6881. for(i=0;i<selectViewKR.children.length;i++){
  6882. if(i < selectViewKR.children.length-1){
  6883. nCurrent = parseInt(selectViewKR.children[i].value.split('~')[1]);
  6884. nNext = parseInt(selectViewKR.children[i+1].value.split('~')[1]);
  6885. if(Math.round((nNext-nCurrent)/60000) < 2)
  6886. selectViewKR.children[i].style = 'color:red';
  6887. }
  6888. strCurrent = selectViewKR.children[i].value.split('~')[2];
  6889. if(strCurrent == strCurrent.toUpperCase() && selectViewKR.children[i].style.color != 'red'){
  6890. selectViewKR.children[i].style = 'color:magenta';
  6891. }
  6892. }
  6893. }
  6894.  
  6895. function loadPreferenceSettingFromStorage() {
  6896. aggressiveMode = getStorageToVariableBool("AggressiveMode", aggressiveMode);
  6897. hornTimeDelayMin = getStorageToVariableInt("HornTimeDelayMin", hornTimeDelayMin);
  6898. hornTimeDelayMax = getStorageToVariableInt("HornTimeDelayMax", hornTimeDelayMax);
  6899. enableTrapCheck = getStorageToVariableBool("TrapCheck", enableTrapCheck);
  6900. checkTimeDelayMin = getStorageToVariableInt("TrapCheckTimeDelayMin", checkTimeDelayMin);
  6901. checkTimeDelayMax = getStorageToVariableInt("TrapCheckTimeDelayMax", checkTimeDelayMax);
  6902. isKingWarningSound = getStorageToVariableBool("PlayKingRewardSound", isKingWarningSound);
  6903. isAutoSolve = getStorageToVariableBool("AutoSolveKR", isAutoSolve);
  6904. krDelayMin = getStorageToVariableInt("AutoSolveKRDelayMin", krDelayMin);
  6905. krDelayMax = getStorageToVariableInt("AutoSolveKRDelayMax", krDelayMax);
  6906. kingsRewardRetry = getStorageToVariableInt("KingsRewardRetry", kingsRewardRetry);
  6907. pauseAtInvalidLocation = getStorageToVariableBool("PauseLocation", pauseAtInvalidLocation);
  6908. saveKRImage = getStorageToVariableBool("SaveKRImage", saveKRImage);
  6909. g_nTimeOffset = getStorageToVariableInt("TimeOffset", g_nTimeOffset);
  6910. discharge = getStorageToVariableBool("discharge", discharge);
  6911. try{
  6912. keyKR = [];
  6913. var keyName = "";
  6914. var keyRemove = [];
  6915. var i, j, value, objTest;
  6916. for(i = 0; i<window.localStorage.length;i++){
  6917. keyName = window.localStorage.key(i);
  6918. if(keyName.indexOf("KR-") > -1){ // remove old KR entries
  6919. keyRemove.push(keyName);
  6920. }
  6921. else if(keyName.indexOf("KR" + separator) > -1){
  6922. keyKR.push(keyName);
  6923. }
  6924. value = getStorage(keyName); // remove entries of duplicate JSON.stringify
  6925. if(value.indexOf("{") > -1){
  6926. try{
  6927. objTest = JSON.parse(value);
  6928. if(typeof objTest == 'string'){
  6929. setStorage(keyName, objTest);
  6930. setSessionStorage(keyName, objTest);
  6931. }
  6932. }
  6933. catch(e){
  6934. console.perror(keyName, e.message);
  6935. }
  6936. }
  6937. }
  6938.  
  6939. for(i = 0; i<keyRemove.length;i++){
  6940. removeStorage(keyRemove[i]);
  6941. }
  6942.  
  6943. if (keyKR.length > maxSaveKRImage){
  6944. keyKR = keyKR.sort();
  6945. var count = Math.floor(maxSaveKRImage / 2);
  6946. for(i=0;i<count;i++)
  6947. removeStorage(keyKR[i]);
  6948. }
  6949.  
  6950. // Backward compatibility of SCCustom
  6951. var temp = "";
  6952. var keyValue = "";
  6953. var obj = {};
  6954. var bResave = false;
  6955. var objSCCustomBackward = {
  6956. zone : ['ZONE_NOT_DIVE'],
  6957. zoneID : [0],
  6958. isHunt : [true],
  6959. bait : ['Gouda'],
  6960. trinket : ['None'],
  6961. useSmartJet : false
  6962. };
  6963. for (var prop in objSCZone) {
  6964. if(objSCZone.hasOwnProperty(prop)) {
  6965. keyName = "SCCustom_" + prop;
  6966. keyValue = window.localStorage.getItem(keyName);
  6967. if(!isNullOrUndefined(keyValue)){
  6968. keyValue = keyValue.split(',');
  6969. objSCCustomBackward.zone[objSCZone[prop]] = prop;
  6970. objSCCustomBackward.zoneID[objSCZone[prop]] = objSCZone[prop];
  6971. objSCCustomBackward.isHunt[objSCZone[prop]] = (keyValue[0] === 'true' || keyValue[0] === true);
  6972. objSCCustomBackward.bait[objSCZone[prop]] = keyValue[1];
  6973. objSCCustomBackward.trinket[objSCZone[prop]] = keyValue[2];
  6974. removeStorage(keyName);
  6975. }
  6976. }
  6977. }
  6978. if(objSCCustomBackward.zone.length > 1){
  6979. setStorage('SCCustom', JSON.stringify(objSCCustomBackward));
  6980. setSessionStorage('SCCustom', JSON.stringify(objSCCustomBackward));
  6981. }
  6982.  
  6983. keyValue = getStorage("SCCustom");
  6984. if(!isNullOrUndefined(keyValue)){
  6985. obj = JSON.parse(keyValue);
  6986. bResave = false;
  6987. var arrTempOri = ['NoSC', 'TT', 'EAC', 'scAnchorTreasure', 'scAnchorDanger', 'scAnchorUlti'];
  6988. var arrTempNew = ['None', 'Treasure Trawling Charm', 'Empowered Anchor Charm', 'GAC_EAC', 'SAC_EAC', 'UAC_EAC'];
  6989. var nIndex = -1;
  6990. for(var prop in obj){
  6991. if(obj.hasOwnProperty(prop) && prop == 'trinket'){
  6992. for(i=0;i<obj[prop].length;i++){
  6993. nIndex = arrTempOri.indexOf(obj[prop][i]);
  6994. if(nIndex > -1){
  6995. obj[prop][i] = arrTempNew[nIndex];
  6996. bResave = true;
  6997. }
  6998. }
  6999. }
  7000. }
  7001. if(obj.zone.indexOf('ZONE_DANGER_PP_LOTA') < 0){
  7002. 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'];
  7003. obj.zoneID = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  7004. nIndex = obj.zone.indexOf('ZONE_DANGER_PP');
  7005. obj.isHunt[10] = obj.isHunt[nIndex];
  7006. obj.bait[10] = obj.bait[nIndex];
  7007. obj.trinket[10] = obj.trinket[nIndex];
  7008. bResave = true;
  7009. }
  7010. if(bResave){
  7011. setStorage("SCCustom", JSON.stringify(obj));
  7012. setSessionStorage("SCCustom", JSON.stringify(obj));
  7013. }
  7014. }
  7015.  
  7016. // Backward compatibility of SGZT
  7017. keyValue = getStorage("SGZT");
  7018. if(!isNullOrUndefined(keyValue)){
  7019. setStorage("SGarden", keyValue);
  7020. setSessionStorage("SGarden", keyValue);
  7021. removeStorage("SGZT");
  7022. removeSessionStorage("SGZT");
  7023. }
  7024.  
  7025. // Backward compatibility of ZTower
  7026. keyValue = getStorage("ZTower");
  7027. if(!isNullOrUndefined(keyValue)){
  7028. obj = JSON.parse(keyValue);
  7029. bResave = false;
  7030. var arrTemp = new Array(7).fill('');
  7031. for(var prop in obj){
  7032. if(obj.hasOwnProperty(prop) &&
  7033. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')){
  7034. if(obj[prop].length == 7){
  7035. obj[prop] = obj[prop].concat(arrTemp);
  7036. bResave = true;
  7037. }
  7038. if(prop == 'bait'){
  7039. for(i=0;i<obj[prop].length;i++){
  7040. if(obj[prop][i] == 'Brie'){
  7041. obj[prop][i] = 'Brie Cheese';
  7042. bResave = true;
  7043. }
  7044. }
  7045. }
  7046. }
  7047. }
  7048. if(bResave){
  7049. setStorage("ZTower", JSON.stringify(obj));
  7050. setSessionStorage("ZTower", JSON.stringify(obj));
  7051. }
  7052. }
  7053.  
  7054. // Backward compatibility of BRCustom
  7055. keyValue = getStorage("BRCustom");
  7056. if(!isNullOrUndefined(keyValue)){
  7057. obj = JSON.parse(keyValue);
  7058. bResave = false;
  7059. for(i=0;i<obj.trinket.length;i++){
  7060. if(obj.trinket[i] == 'None' || obj.trinket[i] == 'NoAbove' || obj.trinket[i] === '' || isNullOrUndefined(obj.trinket[i]))
  7061. continue;
  7062. if(obj.trinket[i].indexOf('Charm') < 0){
  7063. obj.trinket[i] += ' Charm';
  7064. bResave = true;
  7065. }
  7066. }
  7067. if(bResave){
  7068. setStorage("BRCustom", JSON.stringify(obj));
  7069. setSessionStorage("BRCustom", JSON.stringify(obj));
  7070. }
  7071. }
  7072.  
  7073. // Backward compatibility of FRift
  7074. keyValue = getStorage("FRift");
  7075. if(!isNullOrUndefined(keyValue)){
  7076. obj = JSON.parse(keyValue);
  7077. bResave = false;
  7078. for(i=0;i<obj.trinket.length;i++){
  7079. if(obj.trinket[i] == 'None' || obj.trinket[i] == 'NoAbove' || obj.trinket[i] === '' || isNullOrUndefined(obj.trinket[i]))
  7080. continue;
  7081. if(obj.trinket[i].indexOf('Charm') < 0){
  7082. obj.trinket[i] += ' Charm';
  7083. bResave = true;
  7084. }
  7085. }
  7086. if(bResave){
  7087. setStorage("FRift", JSON.stringify(obj));
  7088. setSessionStorage("FRift", JSON.stringify(obj));
  7089. }
  7090. }
  7091.  
  7092. // Remove old LG
  7093. keyValue = getStorage("LGArea");
  7094. if(!isNullOrUndefined(keyValue) && keyValue.split(",").length == 2){
  7095. removeStorage("LGArea");
  7096. removeSessionStorage("LGArea");
  7097. }
  7098.  
  7099. // Backward compatibility of FW
  7100. keyValue = getStorage('FW');
  7101. if(isNullOrUndefined(keyValue)){
  7102. obj = {};
  7103. for(i=1;i<=4;i++){
  7104. temp = 'FW_Wave'+i;
  7105. keyValue = getStorage(temp);
  7106. if(!isNullOrUndefined(keyValue)){
  7107. obj['wave'+i] = JSON.parse(keyValue);
  7108. removeStorage(temp);
  7109. removeSessionStorage(temp);
  7110. }
  7111. else{
  7112. obj['wave'+i] = JSON.parse(JSON.stringify(objDefaultFW));
  7113. }
  7114. }
  7115. setStorage('FW', JSON.stringify(obj));
  7116. }
  7117. else{
  7118. obj = JSON.parse(keyValue);
  7119. bResave = false;
  7120. for(i=1;i<=4;i++){
  7121. temp = 'wave'+i;
  7122. for(j=0;j<obj[temp].cheese.length;j++){
  7123. if(obj[temp].cheese[j] == 'Brie'){
  7124. obj[temp].cheese[j] = 'Brie Cheese';
  7125. bResave = true;
  7126. }
  7127. }
  7128. }
  7129. if(bResave){
  7130. setStorage("FW", JSON.stringify(obj));
  7131. setSessionStorage("FW", JSON.stringify(obj));
  7132. }
  7133. }
  7134.  
  7135. // Backward compatibility of Labyrinth
  7136. keyValue = getStorage('Labyrinth');
  7137. if(isNullOrUndefined(keyValue)){
  7138. obj = {};
  7139. temp = getStorage('Labyrinth_DistrictFocus');
  7140. keyValue = getStorage('Labyrinth_HallwayPriorities');
  7141. if(isNullOrUndefined(keyValue)){
  7142. obj = JSON.parse(JSON.stringify(objDefaultLaby));
  7143. }
  7144. else{
  7145. obj = JSON.parse(keyValue);
  7146. if(isNullOrUndefined(temp))
  7147. temp = 'None';
  7148. obj.districtFocus = temp;
  7149. }
  7150. setStorage('Labyrinth', JSON.stringify(obj));
  7151. temp = ['Labyrinth_DistrictFocus', 'Labyrinth_HallwayPriorities'];
  7152. for(i=0;i<temp.length;i++){
  7153. removeStorage(temp[i]);
  7154. removeSessionStorage(temp[i]);
  7155. }
  7156. }
  7157.  
  7158. // Backward compatibility of Zokor
  7159. keyValue = getStorage('Zokor');
  7160. if(!isNullOrUndefined(keyValue)){
  7161. obj = JSON.parse(keyValue);
  7162. bResave = false;
  7163. for(i=0;i<obj.bait.length;i++){
  7164. if(obj.bait[i] == 'Brie'){
  7165. obj.bait[i] = 'Brie Cheese';
  7166. bResave = true;
  7167. }
  7168. }
  7169. if(bResave){
  7170. setStorage('Zokor', JSON.stringify(obj));
  7171. setSessionStorage('Zokor', JSON.stringify(obj));
  7172. }
  7173. }
  7174.  
  7175. // Backward compatibility of GWH2016R
  7176. keyValue = getStorage('GWH2016R');
  7177. if(!isNullOrUndefined(keyValue)){
  7178. obj = JSON.parse(keyValue);
  7179. bResave = false;
  7180. if(obj.zone.indexOf("NEW_YEAR'S_PARTY") < 0){
  7181. obj.zone.push("NEW_YEAR'S_PARTY");
  7182. obj.weapon.push('');
  7183. obj.base.push('');
  7184. obj.trinket.push('');
  7185. obj.bait.push('');
  7186. obj.boost.push(false);
  7187. bResave = true;
  7188. }
  7189. if(bResave){
  7190. setStorage('GWH2016R', JSON.stringify(obj));
  7191. setSessionStorage('GWH2016R', JSON.stringify(obj));
  7192. }
  7193. }
  7194.  
  7195. // Disable GWH2016
  7196. if(getStorageToVariableStr("eventLocation", "None").indexOf('GWH2016') > -1)
  7197. setStorage("eventLocation", "None");
  7198.  
  7199. // Backward compatibility of GES
  7200. keyValue = getStorage('GES');
  7201. if(!isNullOrUndefined(keyValue)){
  7202. obj = JSON.parse(keyValue);
  7203. if(isNullOrUndefined(obj.SD_BEFORE)){
  7204. var objNew = {
  7205. bLoadCrate : obj.SD.bLoadCrate,
  7206. nMinCrate : obj.SD.nMinCrate,
  7207. bUseRepellent : obj.RR.bUseRepellent,
  7208. nMinRepellent : obj.RR.nMinRepellent,
  7209. bStokeEngine : obj.DC.bStokeEngine,
  7210. nMinFuelNugget : obj.DC.nMinFuelNugget,
  7211. SD_BEFORE : {
  7212. weapon : obj.SD.weapon,
  7213. base : obj.SD.base,
  7214. trinket : obj.SD.trinket.before,
  7215. bait : obj.SD.bait,
  7216. },
  7217. SD_AFTER : {
  7218. weapon : obj.SD.weapon,
  7219. base : obj.SD.base,
  7220. trinket : obj.SD.trinket.after,
  7221. bait : obj.SD.bait,
  7222. },
  7223. RR : {
  7224. weapon : obj.RR.weapon,
  7225. base : obj.RR.base,
  7226. trinket : obj.RR.trinket,
  7227. bait : obj.RR.bait,
  7228. },
  7229. DC : {
  7230. weapon : obj.DC.weapon,
  7231. base : obj.DC.base,
  7232. trinket : obj.DC.trinket,
  7233. bait : obj.DC.bait,
  7234. },
  7235. WAITING : {
  7236. weapon : '',
  7237. base : '',
  7238. trinket : '',
  7239. bait : ''
  7240. }
  7241. };
  7242. setStorage('GES', JSON.stringify(objNew));
  7243. setSessionStorage('GES', JSON.stringify(objNew));
  7244. }
  7245. }
  7246.  
  7247. // Backward compatibility of BWRift
  7248. keyValue = getStorage('BWRift');
  7249. if(!isNullOrUndefined(keyValue)){
  7250. obj = JSON.parse(keyValue);
  7251. bResave = false;
  7252. if(obj.order.length != 16){
  7253. obj.order = ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'];
  7254. bResave = true;
  7255. }
  7256. if(obj.priorities.length != 13){
  7257. if(obj.priorities.length == 11){
  7258. obj.priorities.push('LUCKY');
  7259. obj.priorities.push('HIDDEN');
  7260. }
  7261. else
  7262. obj.priorities = ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'];
  7263. bResave = true;
  7264. }
  7265. if(isNullOrUndefined(obj.specialActivate)){
  7266. obj.specialActivate = {
  7267. forceActivate : new Array(16).fill(false),
  7268. remainingLootActivate : new Array(16).fill(1),
  7269. forceDeactivate : new Array(16).fill(obj.forceDeactivate),
  7270. remainingLootDeactivate : new Array(16).fill(obj.remainingLootDeactivate)
  7271. };
  7272. delete obj.forceDeactivate;
  7273. delete obj.remainingLootDeactivate;
  7274. bResave = true;
  7275. }
  7276. if(obj.minTimeSand.length != 9){
  7277. var arrTemp = new Array(9);
  7278. arrTemp[0] = obj.minTimeSand[0];
  7279. arrTemp[8] = obj.minTimeSand[2];
  7280. for(i=1;i<=7;i++)
  7281. arrTemp[i] = obj.minTimeSand[1];
  7282. obj.minTimeSand = arrTemp;
  7283. bResave = true;
  7284. }
  7285. var objTemp = {
  7286. arrTemp : ['master', 'specialActivate', 'gw', 'al', 'rl', 'gb', 'ic', 'fa'],
  7287. arrLength : [16, 16, 2, 2, 2, 7, 4, 16],
  7288. };
  7289. for(i=0;i<objTemp.arrTemp.length;i++){
  7290. if(obj.hasOwnProperty(objTemp.arrTemp[i])){
  7291. for(var prop in obj[objTemp.arrTemp[i]]){
  7292. if(obj[objTemp.arrTemp[i]].hasOwnProperty(prop)){
  7293. while(obj[objTemp.arrTemp[i]][prop].length < objTemp.arrLength[i]){
  7294. obj[objTemp.arrTemp[i]][prop].push(obj[objTemp.arrTemp[i]][prop][0]);
  7295. bResave = true;
  7296. }
  7297. if(obj[objTemp.arrTemp[i]][prop].length < (objTemp.arrLength[i] * 2)){
  7298. obj[objTemp.arrTemp[i]][prop] = obj[objTemp.arrTemp[i]][prop].concat(obj[objTemp.arrTemp[i]][prop]);
  7299. bResave = true;
  7300. }
  7301. }
  7302. }
  7303. }
  7304. }
  7305. if(bResave){
  7306. setStorage('BWRift', JSON.stringify(obj));
  7307. setSessionStorage('BWRift', JSON.stringify(obj));
  7308. }
  7309. }
  7310. }
  7311. catch (e){
  7312. console.perror('loadPreferenceSettingFromStorage',e.message);
  7313. }
  7314. getTrapList();
  7315. getBestTrap();
  7316. bestLGBase = arrayConcatUnique(bestLGBase, objBestTrap.base.luck);
  7317. bestSCBase = arrayConcatUnique(bestSCBase, objBestTrap.base.luck);
  7318. }
  7319.  
  7320. function getTrapList(category){
  7321. var temp = "";
  7322. var arrObjList;
  7323. if (category === null || category === undefined)
  7324. arrObjList = Object.keys(objTrapList);
  7325. else
  7326. arrObjList = [category];
  7327.  
  7328. for (var i=0;i<arrObjList.length;i++){
  7329. temp = getStorageToVariableStr("TrapList" + capitalizeFirstLetter(arrObjList[i]), "");
  7330. if (temp === ""){
  7331. objTrapList[arrObjList[i]] = [];
  7332. }
  7333. else{
  7334. try{
  7335. objTrapList[arrObjList[i]] = temp.split(",");
  7336. }
  7337. catch (e) {
  7338. objTrapList[arrObjList[i]] = [];
  7339. }
  7340. }
  7341. }
  7342. }
  7343.  
  7344. function clearTrapList(category){
  7345. var arrObjList;
  7346. if (category === null || category === undefined)
  7347. arrObjList = Object.keys(objTrapList);
  7348. else
  7349. arrObjList = [category];
  7350.  
  7351. for (var i=0;i<arrObjList.length;i++){
  7352. removeStorage("TrapList" + capitalizeFirstLetter(arrObjList[i]));
  7353. objTrapList[arrObjList[i]] = [];
  7354. }
  7355. }
  7356.  
  7357. function capitalizeFirstLetter(strIn){
  7358. return strIn.charAt(0).toUpperCase() + strIn.slice(1);
  7359. }
  7360.  
  7361. function getTrapListFromTrapSelector(sort, category, name, isForcedRetry){
  7362. clickTrapSelector(category);
  7363. objTrapList[category] = [];
  7364. var sec = secWait;
  7365. var retry = armTrapRetry;
  7366. var i, j, tagGroupElement, tagElement, nameElement, itemEle;
  7367. var intervalGTLFTS = setInterval(
  7368. function (){
  7369. if(isNewUI)
  7370. itemEle = document.getElementsByClassName('campPage-trap-itemBrowser-item');
  7371. else
  7372. tagGroupElement = document.getElementsByClassName('tagGroup');
  7373.  
  7374. if(isNewUI && itemEle.length > 0){
  7375. for (i = 0; i < itemEle.length; i++) {
  7376. nameElement = itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-name')[0].textContent;
  7377. objTrapList[category].push(nameElement);
  7378. }
  7379. setStorage("TrapList" + capitalizeFirstLetter(category), objTrapList[category].join(","));
  7380. clearInterval(intervalGTLFTS);
  7381. arming = false;
  7382. intervalGTLFTS = null;
  7383. checkThenArm(sort, category, name, isForcedRetry);
  7384. return;
  7385. }
  7386. else if(!isNewUI && tagGroupElement.length > 0){
  7387. for (i = 0; i < tagGroupElement.length; ++i){
  7388. tagElement = tagGroupElement[i].getElementsByTagName('a');
  7389. for (j = 0; j < tagElement.length; ++j){
  7390. nameElement = tagElement[j].getElementsByClassName('name')[0].innerText;
  7391. objTrapList[category].push(nameElement);
  7392. }
  7393. }
  7394. setStorage("TrapList" + capitalizeFirstLetter(category), objTrapList[category].join(","));
  7395. clearInterval(intervalGTLFTS);
  7396. arming = false;
  7397. intervalGTLFTS = null;
  7398. checkThenArm(sort, category, name, isForcedRetry);
  7399. return;
  7400. }
  7401. else{
  7402. --sec;
  7403. if (sec <= 0){
  7404. clickTrapSelector(category);
  7405. sec = secWait;
  7406. --retry;
  7407. if (retry <= 0){
  7408. clearInterval(intervalGTLFTS);
  7409. arming = false;
  7410. intervalGTLFTS = null;
  7411. return;
  7412. }
  7413. }
  7414. }
  7415. }, 1000);
  7416. return;
  7417. }
  7418.  
  7419. function getBestTrap(){
  7420. var obj = getStorage("BestTrap");
  7421. if(!isNullOrUndefined(obj)){
  7422. obj = JSON.parse(obj);
  7423. for (var prop in obj) {
  7424. if(obj.hasOwnProperty(prop) && objBestTrap.hasOwnProperty(prop)){
  7425. for(var prop1 in obj[prop]){
  7426. if(obj[prop].hasOwnProperty(prop1) && objBestTrap[prop].hasOwnProperty(prop1)){
  7427. objBestTrap[prop][prop1] = arrayConcatUnique([obj[prop][prop1]], objBestTrap[prop][prop1]);
  7428. }
  7429. }
  7430. }
  7431. }
  7432. }
  7433. }
  7434.  
  7435. function getStorageToVariableInt(storageName, defaultInt)
  7436. {
  7437. var temp = getStorage(storageName);
  7438. var tempInt = defaultInt;
  7439. if (isNullOrUndefined(temp)) {
  7440. setStorage(storageName, defaultInt);
  7441. }
  7442. else {
  7443. tempInt = parseInt(temp);
  7444. if(Number.isNaN(tempInt))
  7445. tempInt = defaultInt;
  7446. }
  7447. return tempInt;
  7448. }
  7449.  
  7450. function getStorageToVariableStr(storageName, defaultStr)
  7451. {
  7452. var temp = getStorage(storageName);
  7453. if (isNullOrUndefined(temp)) {
  7454. setStorage(storageName, defaultStr);
  7455. temp = defaultStr;
  7456. }
  7457. return temp;
  7458. }
  7459.  
  7460. function getStorageToVariableBool(storageName, defaultBool)
  7461. {
  7462. var temp = getStorage(storageName);
  7463. if (isNullOrUndefined(temp)) {
  7464. setStorage(storageName, defaultBool.toString());
  7465. return defaultBool;
  7466. }
  7467. else if (temp === true || temp.toLowerCase() == "true") {
  7468. return true;
  7469. }
  7470. else {
  7471. return false;
  7472. }
  7473. }
  7474.  
  7475. function getStorageToObject(keyName, objDefault){
  7476. var obj = getStorage(keyName);
  7477. var bCheckNewProp = true;
  7478. if(isNullOrUndefined(obj)){
  7479. obj = JSON.stringify(objDefault);
  7480. setStorage(keyName, obj);
  7481. bCheckNewProp = false;
  7482. }
  7483. obj = JSON.parse(obj);
  7484. if(bCheckNewProp){
  7485. if(assignMissingDefault(obj, objDefault)){
  7486. setStorage(keyName, JSON.stringify(obj));
  7487. }
  7488. }
  7489.  
  7490. return obj;
  7491. }
  7492.  
  7493. function assignMissingDefault(obj, objDefault){
  7494. var bResave = false;
  7495. for(var prop in objDefault){
  7496. if(objDefault.hasOwnProperty(prop) && !obj.hasOwnProperty(prop)){
  7497. obj[prop] = objDefault[prop];
  7498. bResave = true;
  7499. }
  7500. }
  7501.  
  7502. return bResave;
  7503. }
  7504.  
  7505. function displayTimer(title, nextHornTime, checkTime) {
  7506. if (showTimerInTitle) {
  7507. document.title = title;
  7508. }
  7509.  
  7510. if (showTimerInPage) {
  7511. nextHornTimeElement.innerHTML = "<b>Next Hunter Horn Time:</b> " + nextHornTime;
  7512. checkTimeElement.innerHTML = "<b>Next Trap Check Time:</b> " + checkTime;
  7513. }
  7514.  
  7515. title = null;
  7516. nextHornTime = null;
  7517. checkTime = null;
  7518. }
  7519.  
  7520. function displayLocation(locStr) {
  7521. if (showTimerInPage && pauseAtInvalidLocation) {
  7522. travelElement.innerHTML = "<b>Hunt Location:</b> " + locStr;
  7523. }
  7524.  
  7525. locStr = null;
  7526. }
  7527.  
  7528. function displayKingRewardSumTime(timeStr) {
  7529. if (showTimerInPage) {
  7530. if (timeStr) {
  7531. lastKingRewardSumTimeElement.innerHTML = "(" + timeStr + ")";
  7532. }
  7533. else {
  7534. lastKingRewardSumTimeElement.innerHTML = "";
  7535. }
  7536. }
  7537.  
  7538. timeStr = null;
  7539. }
  7540.  
  7541. // ################################################################################################
  7542. // Timer Function - End
  7543. // ################################################################################################
  7544.  
  7545. // ################################################################################################
  7546. // Horn Function - Start
  7547. // ################################################################################################
  7548.  
  7549. function soundHorn() {
  7550. var isAtCampPage = (isNewUI)? (document.getElementById('journalContainer') !== null) : (document.getElementById('huntingTips') !== null) ;
  7551. if (!isAtCampPage) {
  7552. displayTimer("Not At Camp Page", "Not At Camp Page", "Not At Camp Page");
  7553. window.setTimeout(function () { soundHorn(); }, timerRefreshInterval * 1000);
  7554. return;
  7555. }
  7556.  
  7557. // update timer
  7558. displayTimer("Ready to Blow The Horn...", "Ready to Blow The Horn...", "Ready to Blow The Horn...");
  7559.  
  7560. var scriptNode = document.getElementById("scriptNode");
  7561. if (scriptNode) {
  7562. scriptNode.setAttribute("soundedHornAtt", "false");
  7563. }
  7564. scriptNode = null;
  7565.  
  7566. if (!aggressiveMode) {
  7567. // safety mode, check the horn image is there or not before sound the horn
  7568. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('header');
  7569. if (headerElement) {
  7570. // need to make sure that the horn image is ready before we can click on it
  7571. var headerStatus = headerElement.getAttribute('class');
  7572. headerStatus = headerStatus.toLowerCase();
  7573. if (headerStatus.indexOf("hornready") != -1) {
  7574. // found the horn image, let's sound the horn!
  7575.  
  7576. // update timer
  7577. displayTimer("Blowing The Horn...", "Blowing The Horn...", "Blowing The Horn...");
  7578.  
  7579. // simulate mouse click on the horn
  7580. var hornElement = document.getElementsByClassName(strHornButton)[0].firstChild;
  7581. fireEvent(hornElement, 'click');
  7582. hornElement = null;
  7583.  
  7584. // clean up
  7585. headerElement = null;
  7586. headerStatus = null;
  7587.  
  7588. // double check if the horn was already sounded
  7589. window.setTimeout(function () { afterSoundingHorn(); }, 5000);
  7590. }
  7591. else if (headerStatus.indexOf("hornsounding") != -1 || headerStatus.indexOf("hornsounded") != -1) {
  7592. // some one just sound the horn...
  7593.  
  7594. // update timer
  7595. displayTimer("Synchronizing Data...", "Someone had just sound the horn. Synchronizing data...", "Someone had just sound the horn. Synchronizing data...");
  7596.  
  7597. // clean up
  7598. headerElement = null;
  7599. headerStatus = null;
  7600.  
  7601. // load the new data
  7602. window.setTimeout(function () { afterSoundingHorn(); }, 5000);
  7603. }
  7604. else if (headerStatus.indexOf("hornwaiting") != -1) {
  7605. // the horn is not appearing, let check the time again
  7606.  
  7607. // update timer
  7608. displayTimer("Synchronizing Data...", "Hunter horn is not ready yet. Synchronizing data...", "Hunter horn is not ready yet. Synchronizing data...");
  7609.  
  7610. // sync the time again, maybe user already click the horn
  7611. retrieveData();
  7612.  
  7613. checkJournalDate();
  7614.  
  7615. // clean up
  7616. headerElement = null;
  7617. headerStatus = null;
  7618.  
  7619. // loop again
  7620. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7621. }
  7622. else {
  7623. // some one steal the horn!
  7624.  
  7625. // update timer
  7626. displayTimer("Synchronizing Data...", "Hunter horn is missing. Synchronizing data...", "Hunter horn is missing. Synchronizing data...");
  7627.  
  7628. if(isNewUI){
  7629. // sync the time again, maybe user already click the horn
  7630. retrieveData();
  7631.  
  7632. checkJournalDate();
  7633.  
  7634. // clean up
  7635. headerElement = null;
  7636. headerStatus = null;
  7637.  
  7638. // loop again
  7639. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7640. }
  7641. else{
  7642. // try to click on the horn
  7643. var hornElement = document.getElementsByClassName(strHornButton)[0].firstChild;
  7644. fireEvent(hornElement, 'click');
  7645. hornElement = null;
  7646.  
  7647. // clean up
  7648. headerElement = null;
  7649. headerStatus = null;
  7650.  
  7651. // double check if the horn was already sounded
  7652. window.setTimeout(function () { afterSoundingHorn(true); }, 5000);
  7653. }
  7654. }
  7655. }
  7656. else {
  7657. // something wrong, can't even found the header...
  7658.  
  7659. // clean up
  7660. headerElement = null;
  7661.  
  7662. // reload the page see if thing get fixed
  7663. reloadWithMessage("Fail to find the horn header. Reloading...", false);
  7664. }
  7665.  
  7666. }
  7667. else {
  7668. // aggressive mode, ignore whatever horn image is there or not, just sound the horn!
  7669.  
  7670. // simulate mouse click on the horn
  7671. fireEvent(document.getElementsByClassName(strHornButton)[0].firstChild, 'click');
  7672.  
  7673. // double check if the horn was already sounded
  7674. window.setTimeout(function () { afterSoundingHorn(); }, 3000);
  7675. }
  7676. }
  7677.  
  7678. function afterSoundingHorn(bLog) {
  7679. var scriptNode = document.getElementById("scriptNode");
  7680. if (scriptNode) {
  7681. scriptNode.setAttribute("soundedHornAtt", "false");
  7682. }
  7683. scriptNode = null;
  7684.  
  7685. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('header');
  7686. if (headerElement) {
  7687. // double check if the horn image is still visible after the script already sound it
  7688. var headerStatus = headerElement.getAttribute('class');
  7689. headerStatus = headerStatus.toLowerCase();
  7690. if(bLog === true) console.plog('headerStatus:', headerStatus);
  7691. if (headerStatus.indexOf("hornready") != -1) {
  7692. // seen like the horn is not functioning well
  7693.  
  7694. // update timer
  7695. displayTimer("Blowing The Horn Again...", "Blowing The Horn Again...", "Blowing The Horn Again...");
  7696.  
  7697. // simulate mouse click on the horn
  7698. var hornElement = document.getElementsByClassName(strHornButton)[0].firstChild;
  7699. fireEvent(hornElement, 'click');
  7700. hornElement = null;
  7701.  
  7702. // clean up
  7703. headerElement = null;
  7704. headerStatus = null;
  7705.  
  7706. // increase the horn retry counter and check if the script is caugh in loop
  7707. ++hornRetry;
  7708. if (hornRetry > hornRetryMax) {
  7709. // reload the page see if thing get fixed
  7710. reloadWithMessage("Detected script caught in loop. Reloading...", true);
  7711.  
  7712. // reset the horn retry counter
  7713. hornRetry = 0;
  7714. }
  7715. else {
  7716. // check again later
  7717. window.setTimeout(function () { afterSoundingHorn(); }, 1000);
  7718. }
  7719. }
  7720. else if (headerStatus.indexOf("hornsounding") != -1) {
  7721. // the horn is already sound, but the network seen to slow on fetching the data
  7722.  
  7723. // update timer
  7724. 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...");
  7725.  
  7726. // clean up
  7727. headerElement = null;
  7728. headerStatus = null;
  7729.  
  7730. // increase the horn retry counter and check if the script is caugh in loop
  7731. ++hornRetry;
  7732. if (hornRetry > hornRetryMax) {
  7733. // reload the page see if thing get fixed
  7734. reloadWithMessage("Detected script caught in loop. Reloading...", true);
  7735.  
  7736. // reset the horn retry counter
  7737. hornRetry = 0;
  7738. }
  7739. else {
  7740. // check again later
  7741. window.setTimeout(function () { afterSoundingHorn(); }, 3000);
  7742. }
  7743. }
  7744. else {
  7745. // everything look ok
  7746.  
  7747. // update timer
  7748. displayTimer("Horn sounded. Synchronizing Data...", "Horn sounded. Synchronizing data...", "Horn sounded. Synchronizing data...");
  7749.  
  7750. // reload data
  7751. retrieveData();
  7752.  
  7753. // clean up
  7754. headerElement = null;
  7755. headerStatus = null;
  7756.  
  7757. // script continue as normal
  7758. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7759.  
  7760. // reset the horn retry counter
  7761. hornRetry = 0;
  7762. }
  7763. }
  7764. }
  7765.  
  7766. function embedScript() {
  7767. // create a javascript to detect if user click on the horn manually
  7768. var scriptNode = document.createElement('script');
  7769. scriptNode.setAttribute('id', 'scriptNode');
  7770. scriptNode.setAttribute('type', 'text/javascript');
  7771. scriptNode.setAttribute('soundedHornAtt', 'false');
  7772. scriptNode.innerHTML = ' \
  7773. function soundedHorn(){ \
  7774. var scriptNode = document.getElementById("scriptNode"); \
  7775. if (scriptNode){ \
  7776. scriptNode.setAttribute("soundedHornAtt", "true"); \
  7777. } \
  7778. scriptNode = null; \
  7779. }';
  7780.  
  7781. // find the head node and insert the script into it
  7782. var headerElement;
  7783. if (fbPlatform || hiFivePlatform || mhPlatform) {
  7784. headerElement = document.getElementById('noscript');
  7785. }
  7786. else if (mhMobilePlatform) {
  7787. headerElement = document.getElementById('mobileHorn');
  7788. }
  7789. headerElement.parentNode.insertBefore(scriptNode, headerElement);
  7790. scriptNode = null;
  7791. headerElement = null;
  7792.  
  7793. // change the function call of horn
  7794. var testNewUI = document.getElementById('header');
  7795. if (!isNullOrUndefined(testNewUI)) {
  7796. // old UI
  7797. isNewUI = false;
  7798. strHornButton = 'hornbutton';
  7799. strCampButton = 'campbutton';
  7800. }
  7801. else {
  7802. // new UI
  7803. isNewUI = true;
  7804. strHornButton = 'mousehuntHud-huntersHorn-container';
  7805. strCampButton = 'camp';
  7806. //alert("New UI might not work properly with this script. Use at your own risk");
  7807. document.getElementById('titleElement').innerHTML += " - <font color='red'><b>Pls use Classic UI (i.e. Non-FreshCoat Layout) for fully working features</b></font>";
  7808. }
  7809. setStorage('NewUI', isNewUI);
  7810.  
  7811. var hornButtonLink = document.getElementsByClassName(strHornButton)[0].firstChild;
  7812. var oriStr = hornButtonLink.getAttribute('onclick').toString();
  7813. var index = oriStr.indexOf('return false;');
  7814. var modStr = oriStr.substring(0, index) + 'soundedHorn();' + oriStr.substring(index);
  7815. hornButtonLink.setAttribute('onclick', modStr);
  7816.  
  7817. hornButtonLink = null;
  7818. oriStr = null;
  7819. index = null;
  7820. modStr = null;
  7821. }
  7822.  
  7823. // ################################################################################################
  7824. // Horn Function - End
  7825. // ################################################################################################
  7826.  
  7827.  
  7828.  
  7829. // ################################################################################################
  7830. // King's Reward Function - Start
  7831. // ################################################################################################
  7832.  
  7833. function kingRewardAction() {
  7834. // update timer
  7835. displayTimer("King's Reward!", "King's Reward!", "King's Reward!");
  7836. displayLocation("-");
  7837.  
  7838. // play music if needed
  7839. playKingRewardSound();
  7840.  
  7841. // focus on the answer input
  7842. var inputElementList = document.getElementsByTagName('input');
  7843. if (inputElementList) {
  7844. for (var i = 0; i < inputElementList.length; ++i) {
  7845. // check if it is a resume button
  7846. if (inputElementList[i].getAttribute('name') == "puzzle_answer") {
  7847. inputElementList[i].focus();
  7848. break;
  7849. }
  7850. }
  7851. }
  7852. inputElementList = null;
  7853.  
  7854. // retrieve last king's reward time
  7855. var lastDate = getStorage("lastKingRewardDate");
  7856. lastDate = (isNullOrUndefined(lastDate)) ? new Date(0) : new Date(lastDate);
  7857.  
  7858. // record last king's reward time
  7859. var nowDate = new Date();
  7860. setStorage("lastKingRewardDate", nowDate.toString());
  7861. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  7862. var nInterval = Math.abs(nowDate - lastDate) / 1000; // in second
  7863.  
  7864. console.plog("Last KR:", new Date(Date.parse(lastDate)+nTimezoneOffset).toISOString(), "Current KR:", new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString(), "Interval:", timeFormat(nInterval));
  7865. if (!isAutoSolve){
  7866. var intervalCRB = setInterval(
  7867. function (){
  7868. if (checkResumeButton()){
  7869. clearInterval(intervalCRB);
  7870. intervalCRB = null;
  7871. return;
  7872. }
  7873. }, 1000);
  7874. return;
  7875. }
  7876.  
  7877. var krDelaySec = krDelayMax;
  7878. if (kingsRewardRetry > 0){
  7879. var nMin = krDelayMin / (kingsRewardRetry * 2);
  7880. var nMax = krDelayMax / (kingsRewardRetry * 2);
  7881. krDelaySec = nMin + Math.floor(Math.random() * (nMax - nMin));
  7882. }
  7883. else
  7884. krDelaySec = krDelayMin + Math.floor(Math.random() * (krDelayMax - krDelayMin));
  7885.  
  7886. var krStopHourNormalized = krStopHour;
  7887. var krStartHourNormalized = krStartHour;
  7888. if (krStopHour > krStartHour){ // e.g. Stop to Start => 22 to 06
  7889. var offset = 24 - krStopHour;
  7890. krStartHourNormalized = krStartHour + offset;
  7891. krStopHourNormalized = 0;
  7892. nowDate.setHours(nowDate.getHours() + offset);
  7893. }
  7894.  
  7895. if (nowDate.getHours() >= krStopHourNormalized && nowDate.getHours() < krStartHourNormalized && nInterval > (5*60)){
  7896. var krDelayMinute = krStartHourDelayMin + Math.floor(Math.random() * (krStartHourDelayMax - krStartHourDelayMin));
  7897. krDelaySec += krStartHour * 3600 - (nowDate.getHours() * 3600 + nowDate.getMinutes() * 60 + nowDate.getSeconds());
  7898. krDelaySec += krDelayMinute * 60;
  7899. kingRewardCountdownTimer(krDelaySec, true);
  7900. }
  7901. else{
  7902. kingRewardCountdownTimer(krDelaySec, false);
  7903. }
  7904. }
  7905.  
  7906. function playKingRewardSound() {
  7907. if (isKingWarningSound) {
  7908. unsafeWindow.hornAudio = new Audio('https://raw.githubusercontent.com/devcnn88/MHAutoBotEnhanced/master/resources/Girtab.mp3');
  7909. hornAudio.loop = true;
  7910. hornAudio.play();
  7911. }
  7912. }
  7913.  
  7914. function kingRewardCountdownTimer(interval, isReloadToSolve)
  7915. {
  7916. var strTemp = (isReloadToSolve) ? "Reload to solve KR in " : "Solve KR in (extra few sec delay) ";
  7917. strTemp = strTemp + timeFormat(interval);
  7918. displayTimer(strTemp, strTemp, strTemp);
  7919. interval -= timerRefreshInterval;
  7920. if (interval < 0)
  7921. {
  7922. if (isReloadToSolve)
  7923. {
  7924. strTemp = "Reloading...";
  7925. displayTimer(strTemp, strTemp, strTemp);
  7926. if(isNewUI){
  7927. reloadPage(false);
  7928. }
  7929. else{
  7930. // simulate mouse click on the camp button
  7931. var campElement = document.getElementsByClassName(strCampButton)[0].firstChild;
  7932. fireEvent(campElement, 'click');
  7933. campElement = null;
  7934. }
  7935.  
  7936. // reload the page if click on the camp button fail
  7937. window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  7938. }
  7939. else
  7940. {
  7941. strTemp = "Solving...";
  7942. displayTimer(strTemp, strTemp, strTemp);
  7943. var intervalCRB = setInterval(
  7944. function ()
  7945. {
  7946. if (checkResumeButton())
  7947. {
  7948. clearInterval(intervalCRB);
  7949. intervalCRB = null;
  7950. return;
  7951. }
  7952. }, 1000);
  7953. CallKRSolver();
  7954. }
  7955. }
  7956. else
  7957. {
  7958. if (!checkResumeButton()) {
  7959. window.setTimeout(function () { kingRewardCountdownTimer(interval, isReloadToSolve); }, timerRefreshInterval * 1000);
  7960. }
  7961. }
  7962. }
  7963.  
  7964. function checkResumeButton() {
  7965. var found = false;
  7966. var resumeElement;
  7967. if (isNewUI) {
  7968. var krFormClass = document.getElementsByTagName('form')[0].className;
  7969. if (krFormClass.indexOf("noPuzzle") > -1) {
  7970. // found resume button
  7971.  
  7972. // simulate mouse click on the resume button
  7973. resumeElement = document.getElementsByClassName('mousehuntPage-puzzle-form-complete-button')[0];
  7974. var nowDate = new Date();
  7975. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  7976. console.plog('Click Resume button at:', new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString());
  7977. fireEvent(resumeElement, 'click');
  7978. resumeElement = null;
  7979.  
  7980. var nRetry = 5;
  7981. var intervalCRB1 = setInterval( function (){
  7982. if (isNullOrUndefined(document.getElementById('journalContainer'))) {
  7983. // not at camp page
  7984. --nRetry;
  7985. if(nRetry <= 0){
  7986. // reload url if click fail
  7987. reloadWithMessage("Fail to click on resume button. Reloading...", false);
  7988. clearInterval(intervalCRB1);
  7989. }
  7990. }
  7991. else{
  7992. var lastKingRewardDate = getStorage("lastKingRewardDate");
  7993. var lastDateStr;
  7994. if (isNullOrUndefined(lastKingRewardDate)) {
  7995. lastDateStr = "-";
  7996. lastKingRewardSumTime = -1;
  7997. }
  7998. else {
  7999. var lastDate = new Date(lastKingRewardDate);
  8000. lastDateStr = lastDate.toDateString() + " " + lastDate.toTimeString().substring(0, 8);
  8001. lastKingRewardSumTime = parseInt((new Date() - lastDate) / 1000);
  8002. }
  8003. kingTimeElement.innerHTML = "<b>Last King's Reward:</b> " + lastDateStr + " ";
  8004. kingTimeElement.appendChild(lastKingRewardSumTimeElement);
  8005. retrieveData(true);
  8006. countdownTimer();
  8007. addKREntries();
  8008. setKREntriesColor();
  8009. clearInterval(intervalCRB1);
  8010. }
  8011. }, 1000);
  8012. found = true;
  8013. }
  8014. krFormClass = null;
  8015. }
  8016. else{
  8017. var linkElementList = document.getElementsByTagName('img');
  8018. if (linkElementList) {
  8019. var i;
  8020. for (i = 0; i < linkElementList.length; ++i) {
  8021. // check if it is a resume button
  8022. if (linkElementList[i].getAttribute('src').indexOf("resume_hunting_blue.gif") != -1) {
  8023. // found resume button
  8024.  
  8025. // simulate mouse click on the horn
  8026. resumeElement = linkElementList[i].parentNode;
  8027. var nowDate = new Date();
  8028. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  8029. console.plog('Click Resume button at:', new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString());
  8030. fireEvent(resumeElement, 'click');
  8031. resumeElement = null;
  8032.  
  8033. // reload url if click fail
  8034. window.setTimeout(function () {
  8035. console.perror('Fail to click on resume button:', new Date());
  8036. reloadWithMessage("Fail to click on resume button. Reloading...", false);
  8037. }, 6000);
  8038.  
  8039. // recheck if the resume button is click because some time even the url reload also fail
  8040.  
  8041. window.setTimeout(function () {
  8042. console.perror('Recheck resume button:', new Date());
  8043. checkResumeButton();
  8044. }, 10000);
  8045.  
  8046. found = true;
  8047. break;
  8048. }
  8049. }
  8050. i = null;
  8051. }
  8052. linkElementList = null;
  8053. }
  8054.  
  8055. try {
  8056. return (found);
  8057. }
  8058. finally {
  8059. found = null;
  8060. }
  8061. }
  8062.  
  8063. function CallKRSolver()
  8064. {
  8065. var frame = document.createElement('iframe');
  8066. frame.setAttribute("id", "myFrame");
  8067. var img;
  8068. if (debugKR){
  8069. //frame.src = "https://dl.dropboxusercontent.com/s/4u5msso39hfpo87/Capture.PNG";
  8070. //frame.src = "https://dl.dropboxusercontent.com/s/og73bcdsn2qod63/download%20%2810%29Ori.png";
  8071. frame.src = "https://dl.dropboxusercontent.com/s/ppg0l35h25phrx3/download%20(16).png";
  8072. }
  8073. else{
  8074. if(isNewUI){
  8075. img = document.getElementsByClassName('mousehuntPage-puzzle-form-captcha-image')[0];
  8076. frame.src = img.style.backgroundImage.slice(4, -1).replace(/"/g, "");
  8077. }
  8078. else{
  8079. img = document.getElementById('puzzleImage');
  8080. frame.src = img.src;
  8081. }
  8082. }
  8083. document.body.appendChild(frame);
  8084. }
  8085.  
  8086. function CheckKRAnswerCorrectness()
  8087. {
  8088. var strTemp = '';
  8089. if(isNewUI){
  8090. var codeError = document.getElementsByClassName("mousehuntPage-puzzle-form-code-error");
  8091. for(var i=0;i<codeError.length;i++){
  8092. if(codeError[i].innerText.toLowerCase().indexOf("incorrect claim code") > -1){
  8093. if (kingsRewardRetry >= kingsRewardRetryMax){
  8094. kingsRewardRetry = 0;
  8095. setStorage("KingsRewardRetry", kingsRewardRetry);
  8096. strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  8097. alert(strTemp);
  8098. displayTimer(strTemp, strTemp, strTemp);
  8099. console.perror(strTemp);
  8100. }
  8101. else{
  8102. ++kingsRewardRetry;
  8103. setStorage("KingsRewardRetry", kingsRewardRetry);
  8104. CallKRSolver();
  8105. }
  8106. return;
  8107. }
  8108. }
  8109. }
  8110. else{
  8111. var pageMsg = document.getElementById('pagemessage');
  8112. if (!isNullOrUndefined(pageMsg) && pageMsg.innerText.toLowerCase().indexOf("unable to claim reward") > -1){ // KR answer not correct, re-run OCR
  8113. if (kingsRewardRetry >= kingsRewardRetryMax){
  8114. kingsRewardRetry = 0;
  8115. setStorage("KingsRewardRetry", kingsRewardRetry);
  8116. strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  8117. alert(strTemp);
  8118. displayTimer(strTemp, strTemp, strTemp);
  8119. console.perror(strTemp);
  8120. }
  8121. else{
  8122. ++kingsRewardRetry;
  8123. setStorage("KingsRewardRetry", kingsRewardRetry);
  8124. CallKRSolver();
  8125. }
  8126. return;
  8127. }
  8128. }
  8129.  
  8130. window.setTimeout(function () { CheckKRAnswerCorrectness(); }, 1000);
  8131. }
  8132.  
  8133. // ################################################################################################
  8134. // King's Reward Function - End
  8135. // ################################################################################################
  8136.  
  8137.  
  8138.  
  8139. // ################################################################################################
  8140. // Trap Check Function - Start
  8141. // ################################################################################################
  8142.  
  8143. function trapCheck() {
  8144. // update timer
  8145. displayTimer("Checking The Trap...", "Checking trap now...", "Checking trap now...");
  8146.  
  8147. // simulate mouse click on the camp button
  8148. var campElement = document.getElementsByClassName(strCampButton)[0].firstChild;
  8149. fireEvent(campElement, 'click');
  8150. campElement = null;
  8151.  
  8152. // reload the page if click on camp button fail
  8153. // window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  8154. var nDelay = 5000;
  8155. window.setTimeout(function () { retrieveData(); }, nDelay);
  8156. window.setTimeout(function () { countdownTimer(); }, nDelay + timerRefreshInterval * 1000);
  8157. }
  8158.  
  8159. function CalculateNextTrapCheckInMinute() {
  8160. if (enableTrapCheck) {
  8161. var now = (g_nTimeOffset === 0) ? new Date() : new Date(Date.now() + g_nTimeOffset*1000);
  8162. var temp = (trapCheckTimeDiff * 60) - (now.getMinutes() * 60 + now.getSeconds());
  8163. checkTimeDelay = checkTimeDelayMin + Math.round(Math.random() * (checkTimeDelayMax - checkTimeDelayMin));
  8164. checkTime = (now.getMinutes() >= trapCheckTimeDiff) ? 3600 + temp : temp;
  8165. checkTime += checkTimeDelay;
  8166. now = undefined;
  8167. temp = undefined;
  8168. }
  8169. }
  8170.  
  8171. // ################################################################################################
  8172. // Trap Check Function - End
  8173. // ################################################################################################
  8174.  
  8175.  
  8176. // ################################################################################################
  8177. // General Function - Start
  8178. // ################################################################################################
  8179.  
  8180. function ajaxPost(postURL, objData, callback, throwerror){
  8181. try {
  8182. jQuery.ajax({
  8183. type: 'POST',
  8184. url: postURL,
  8185. data: objData,
  8186. contentType: 'application/x-www-form-urlencoded',
  8187. dataType: 'json',
  8188. xhrFields: {
  8189. withCredentials: false
  8190. },
  8191. success: callback,
  8192. error: throwerror,
  8193. });
  8194. }
  8195. catch (e) {
  8196. throwerror(e);
  8197. }
  8198. }
  8199.  
  8200. function isNullOrUndefined(obj){
  8201. return (obj === null || obj === undefined || obj === 'null' || obj === 'undefined');
  8202. }
  8203.  
  8204. function getAllIndices(arr, val) {
  8205. var indices = [];
  8206. for(var i = 0; i < arr.length; i++){
  8207. if (arr[i] === val)
  8208. indices.push(i);
  8209. }
  8210. return indices;
  8211. }
  8212.  
  8213. function range(value, min, max){
  8214. if(value > max)
  8215. value = max;
  8216. else if(value < min)
  8217. value = min;
  8218. else if(Number.isNaN(value))
  8219. value = min + Math.floor(Math.random() * (max - min));
  8220.  
  8221. return value;
  8222. }
  8223.  
  8224. function min(data){
  8225. var value = Number.MAX_SAFE_INTEGER;
  8226. for (var i=0;i<data.length;i++){
  8227. if (data[i] < value)
  8228. value = data[i];
  8229. }
  8230. return value;
  8231. }
  8232.  
  8233. function minIndex(data){
  8234. var value = Number.MAX_SAFE_INTEGER;
  8235. var index = -1;
  8236. for (var i=0;i<data.length;i++){
  8237. if (data[i] < value){
  8238. value = data[i];
  8239. index = i;
  8240. }
  8241. }
  8242. return index;
  8243. }
  8244.  
  8245. function max(data){
  8246. var value = Number.MIN_SAFE_INTEGER;
  8247. for (var i=0;i<data.length;i++){
  8248. if (data[i] > value)
  8249. value = data[i];
  8250. }
  8251. return value;
  8252. }
  8253.  
  8254. function maxIndex(data){
  8255. var value = Number.MIN_SAFE_INTEGER;
  8256. var index = -1;
  8257. for (var i=0;i<data.length;i++){
  8258. if (data[i] > value){
  8259. value = data[i];
  8260. index = i;
  8261. }
  8262. }
  8263. return index;
  8264. }
  8265.  
  8266. function arrayConcatUnique(arrOriginal, arrConcat){
  8267. if(!Array.isArray(arrOriginal))
  8268. arrOriginal = [arrOriginal];
  8269. if(!Array.isArray(arrConcat))
  8270. arrConcat = [arrConcat];
  8271.  
  8272. var nIndex = -1;
  8273. var arrTemp = arrConcat.slice();
  8274. for(var i=0;i<arrOriginal.length;i++){
  8275. nIndex = arrTemp.indexOf(arrOriginal[i]);
  8276. if(nIndex > -1)
  8277. arrTemp.splice(nIndex, 1);
  8278. }
  8279. arrTemp = arrOriginal.concat(arrTemp);
  8280. return arrTemp;
  8281. }
  8282.  
  8283. function countUnique(arrIn){
  8284. var objCount = {
  8285. value : [],
  8286. count : [],
  8287. };
  8288.  
  8289. arrIn.forEach(function(i) {
  8290. var index = objCount.value.indexOf(i);
  8291. if (index < 0){
  8292. objCount.value.push(i);
  8293. objCount.count.push(1);
  8294. }
  8295. else {
  8296. objCount.count[index]++;
  8297. }
  8298. });
  8299.  
  8300. return objCount;
  8301. }
  8302.  
  8303. function hasDuplicate(arrIn){
  8304. var obj = countUnique(arrIn);
  8305. for (var i=0;i<obj.count.length;i++){
  8306. if(obj.count[i] > 1)
  8307. return true;
  8308. }
  8309. return false;
  8310. }
  8311.  
  8312. function countArrayElement(value, arrIn){
  8313. var count = 0;
  8314. for (var i=0;i<arrIn.length;i++){
  8315. if (arrIn[i] == value)
  8316. count++;
  8317. }
  8318. return count;
  8319. }
  8320.  
  8321. function sortWithIndices(toSort, sortType) {
  8322. var arr = toSort.slice();
  8323. var objSorted = {
  8324. value : [],
  8325. index : []
  8326. };
  8327. for (var i = 0; i < arr.length; i++) {
  8328. arr[i] = [arr[i], i];
  8329. }
  8330.  
  8331. if (sortType == "descend"){
  8332. arr.sort(function(left, right) {
  8333. return left[0] > right[0] ? -1 : 1;
  8334. });
  8335. }
  8336. else {
  8337. arr.sort(function(left, right) {
  8338. return left[0] < right[0] ? -1 : 1;
  8339. });
  8340. }
  8341.  
  8342. for (var j = 0; j < arr.length; j++) {
  8343. objSorted.value.push(arr[j][0]);
  8344. objSorted.index.push(arr[j][1]);
  8345. }
  8346. return objSorted;
  8347. }
  8348.  
  8349. function standardDeviation(values){
  8350. var avg = average(values);
  8351. var squareDiffs = values.map(function(value){
  8352. var diff = value - avg;
  8353. var sqrDiff = diff * diff;
  8354. return sqrDiff;
  8355. });
  8356.  
  8357. var avgSquareDiff = average(squareDiffs);
  8358. var stdDev = Math.sqrt(avgSquareDiff);
  8359. return stdDev;
  8360. }
  8361.  
  8362. function sumData(data){
  8363. var sum = data.reduce(function(sum, value){
  8364. return sum + value;
  8365. }, 0);
  8366.  
  8367. return sum;
  8368. }
  8369.  
  8370. function average(data){
  8371. var avg = sumData(data) / data.length;
  8372. return avg;
  8373. }
  8374.  
  8375. function moveArrayElement(arr, fromIndex, toIndex) {
  8376. arr.splice(toIndex,0,arr.splice(fromIndex,1)[0]);
  8377. }
  8378.  
  8379. function functionToHTMLString(func){
  8380. var str = func.toString();
  8381. str = str.substring(str.indexOf("{")+1, str.lastIndexOf("}"));
  8382. str = replaceAll(str, '"', '\'');
  8383. return str;
  8384. }
  8385.  
  8386. function replaceAll(str, find, replace) {
  8387. return str.replace(new RegExp(find, 'g'), replace);
  8388. }
  8389.  
  8390. function browserDetection() {
  8391. var browserName = "unknown";
  8392. var userAgentStr = navigator.userAgent.toString().toLowerCase();
  8393. if (userAgentStr.indexOf("firefox") >= 0)
  8394. browserName = "firefox";
  8395. else if (userAgentStr.indexOf("opera") >= 0 || userAgentStr.indexOf("opr/") >= 0)
  8396. browserName = "opera";
  8397. else if (userAgentStr.indexOf("chrome") >= 0)
  8398. browserName = "chrome";
  8399. setStorage('Browser', browserName);
  8400. setStorage('UserAgent', userAgentStr);
  8401. return browserName;
  8402. }
  8403.  
  8404. function setSessionStorage(name, value) {
  8405. // check if the web browser support HTML5 storage
  8406. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8407. window.sessionStorage.setItem(name, value);
  8408. }
  8409.  
  8410. name = undefined;
  8411. value = undefined;
  8412. }
  8413.  
  8414. function removeSessionStorage(name) {
  8415. // check if the web browser support HTML5 storage
  8416. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8417. window.sessionStorage.removeItem(name);
  8418. }
  8419. name = undefined;
  8420. }
  8421.  
  8422. function getSessionStorage(name) {
  8423. // check if the web browser support HTML5 storage
  8424. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8425. return (window.sessionStorage.getItem(name));
  8426. }
  8427. name = undefined;
  8428. }
  8429.  
  8430. function clearSessionStorage() {
  8431. // check if the web browser support HTML5 storage
  8432. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage))
  8433. window.sessionStorage.clear();
  8434. }
  8435.  
  8436. function setStorage(name, value) {
  8437. // check if the web browser support HTML5 storage
  8438. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8439. window.localStorage.setItem(name, value);
  8440. }
  8441.  
  8442. name = undefined;
  8443. value = undefined;
  8444. }
  8445.  
  8446. function removeStorage(name) {
  8447. // check if the web browser support HTML5 storage
  8448. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8449. window.localStorage.removeItem(name);
  8450. }
  8451. name = undefined;
  8452. }
  8453.  
  8454. function getStorage(name) {
  8455. // check if the web browser support HTML5 storage
  8456. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8457. return (window.localStorage.getItem(name));
  8458. }
  8459. name = undefined;
  8460. }
  8461.  
  8462. function getCookie(c_name) {
  8463. if (document.cookie.length > 0) {
  8464. var c_start = document.cookie.indexOf(c_name + "=");
  8465. if (c_start != -1) {
  8466. c_start = c_start + c_name.length + 1;
  8467. var c_end = document.cookie.indexOf(";", c_start);
  8468. if (c_end == -1) {
  8469. c_end = document.cookie.length;
  8470. }
  8471.  
  8472. var cookieString = unescape(document.cookie.substring(c_start, c_end));
  8473.  
  8474. // clean up
  8475. c_name = null;
  8476. c_start = null;
  8477. c_end = null;
  8478.  
  8479. try {
  8480. return cookieString;
  8481. }
  8482. finally {
  8483. cookieString = null;
  8484. }
  8485. }
  8486. c_start = null;
  8487. }
  8488. c_name = null;
  8489. return null;
  8490. }
  8491.  
  8492. function disarmTrap(trapSelector) {
  8493. if(trapSelector == 'weapon' || trapSelector == 'base')
  8494. return;
  8495.  
  8496. var nQuantity = parseInt(getPageVariable("user." + trapSelector + "_quantity"));
  8497. if(nQuantity === 0){
  8498. deleteArmingFromList(trapSelector);
  8499. if(isNewUI && !isArmingInList())
  8500. closeTrapSelector(trapSelector);
  8501. arming = false;
  8502. return;
  8503. }
  8504. var x;
  8505. var strTemp = "";
  8506. var intervalDisarm = setInterval(
  8507. function (){
  8508. if(arming === false){
  8509. addArmingIntoList(trapSelector);
  8510. clickTrapSelector(trapSelector);
  8511. var intervalDT = setInterval(
  8512. function () {
  8513. if(isNewUI){
  8514. x = document.getElementsByClassName('campPage-trap-itemBrowser-item-disarmButton');
  8515. if(x.length > 0){
  8516. fireEvent(x[0], 'click');
  8517. console.plog('Disarmed');
  8518. deleteArmingFromList(trapSelector);
  8519. if(isNewUI && !isArmingInList())
  8520. closeTrapSelector(trapSelector);
  8521. arming = false;
  8522. //window.setTimeout(function () { closeTrapSelector(trapSelector); }, 1000);
  8523. clearInterval(intervalDT);
  8524. intervalDT = null;
  8525. return;
  8526. }
  8527. }
  8528. else{
  8529. x = document.getElementsByClassName(trapSelector + ' canDisarm');
  8530. if (x.length > 0) {
  8531. for (var i = 0; i < x.length; ++i) {
  8532. strTemp = x[i].getAttribute('title');
  8533. if (strTemp.indexOf('Click to disarm') > -1) {
  8534. fireEvent(x[i], 'click');
  8535. console.plog('Disarmed');
  8536. deleteArmingFromList(trapSelector);
  8537. arming = false;
  8538. clearInterval(intervalDT);
  8539. intervalDT = null;
  8540. return;
  8541. }
  8542. }
  8543. }
  8544. }
  8545. }, 1000);
  8546. clearInterval(intervalDisarm);
  8547. intervalDisarm = null;
  8548. }
  8549. }, 1000);
  8550. return;
  8551. }
  8552.  
  8553. function fireEvent(element, event) {
  8554. if(element === null || element === undefined)
  8555. return;
  8556. var evt;
  8557. if (document.createEventObject) {
  8558. // dispatch for IE
  8559. evt = document.createEventObject();
  8560.  
  8561. try {
  8562. return element.fireEvent('on' + event, evt);
  8563. }
  8564. finally {
  8565. element = null;
  8566. event = null;
  8567. evt = null;
  8568. }
  8569. }
  8570. else {
  8571. // dispatch for firefox + others
  8572. evt = new MouseEvent(event, {
  8573. "bubbles": true,
  8574. "cancelable": true
  8575. });
  8576.  
  8577. try {
  8578. return !element.dispatchEvent(evt);
  8579. }
  8580. finally {
  8581. element = null;
  8582. event = null;
  8583. evt = null;
  8584. }
  8585. }
  8586. }
  8587.  
  8588. function getPageVariable(variableName) {
  8589. var value = "";
  8590. try {
  8591. if (browser == 'chrome' || browser == 'opera') {
  8592. // google chrome & opera only
  8593. var scriptElement = document.createElement("script");
  8594. scriptElement.setAttribute('id', "scriptElement");
  8595. scriptElement.setAttribute('type', "text/javascript");
  8596. scriptElement.innerHTML = "document.getElementById('scriptElement').innerText=" + variableName + ";";
  8597. document.body.appendChild(scriptElement);
  8598.  
  8599. value = scriptElement.innerHTML;
  8600. document.body.removeChild(scriptElement);
  8601. scriptElement = null;
  8602. variableName = null;
  8603. }
  8604. }
  8605. catch (e) {
  8606. console.perror('getPageVariable',e.message);
  8607. }
  8608. return value;
  8609. }
  8610.  
  8611. function timeElapsed(dateA, dateB) {
  8612. var elapsed = 0;
  8613.  
  8614. var secondA = Date.UTC(dateA.getFullYear(), dateA.getMonth(), dateA.getDate(), dateA.getHours(), dateA.getMinutes(), dateA.getSeconds());
  8615. var secondB = Date.UTC(dateB.getFullYear(), dateB.getMonth(), dateB.getDate(), dateB.getHours(), dateB.getMinutes(), dateB.getSeconds());
  8616. elapsed = (secondB - secondA) / 1000;
  8617.  
  8618. secondA = null;
  8619. secondB = null;
  8620. dateA = null;
  8621. dateB = null;
  8622.  
  8623. try {
  8624. return (elapsed);
  8625. }
  8626. finally {
  8627. elapsed = null;
  8628. }
  8629. }
  8630.  
  8631. function timeFormat(time) {
  8632. var timeString;
  8633. var hr = Math.floor(time / 3600);
  8634. var min = Math.floor((time % 3600) / 60);
  8635. var sec = (time % 3600 % 60) % 60;
  8636.  
  8637. if (hr > 0) {
  8638. timeString = hr.toString() + " hr " + min.toString() + " min " + sec.toString() + " sec";
  8639. }
  8640. else if (min > 0) {
  8641. timeString = min.toString() + " min " + sec.toString() + " sec";
  8642. }
  8643. else {
  8644. timeString = sec.toString() + " sec";
  8645. }
  8646.  
  8647. time = null;
  8648. hr = null;
  8649. min = null;
  8650. sec = null;
  8651.  
  8652. try {
  8653. return (timeString);
  8654. }
  8655. finally {
  8656. timeString = null;
  8657. }
  8658. }
  8659.  
  8660. function timeFormatLong(time) {
  8661. var timeString;
  8662.  
  8663. if (time != -1) {
  8664. var day = Math.floor(time / 86400);
  8665. var hr = Math.floor((time % 86400) / 3600);
  8666. var min = Math.floor((time % 3600) / 60);
  8667.  
  8668. if (day > 0) {
  8669. timeString = day.toString() + " day " + hr.toString() + " hr " + min.toString() + " min ago";
  8670. }
  8671. else if (hr > 0) {
  8672. timeString = hr.toString() + " hr " + min.toString() + " min ago";
  8673. }
  8674. else if (min > 0) {
  8675. timeString = min.toString() + " min ago";
  8676. }
  8677.  
  8678. day = null;
  8679. hr = null;
  8680. min = null;
  8681. }
  8682. else {
  8683. timeString = null;
  8684. }
  8685.  
  8686. time = null;
  8687.  
  8688. try {
  8689. return (timeString);
  8690. }
  8691. finally {
  8692. timeString = null;
  8693. }
  8694. }
  8695. // ################################################################################################
  8696. // General Function - End
  8697. // ################################################################################################
  8698.  
  8699. // ################################################################################################
  8700. // HTML Function - Start
  8701. // ################################################################################################
  8702. function refreshTrapList() {
  8703. try {
  8704. var objUserHash = {
  8705. uh : user.unique_hash
  8706. };
  8707.  
  8708. jQuery.ajax({
  8709. type: 'POST',
  8710. url: '/managers/ajax/users/gettrapcomponents.php',
  8711. data: objUserHash,
  8712. contentType: 'text/plain',
  8713. dataType: 'json',
  8714. xhrFields: {
  8715. withCredentials: false
  8716. },
  8717. timeout: 10000,
  8718. statusCode: {
  8719. 200: function () {}
  8720. },
  8721. success: function (data){
  8722. var objTrap = {
  8723. weapon : [],
  8724. base : [],
  8725. trinket : [],
  8726. bait : []
  8727. };
  8728. for (var i=0;i<data.components.length;i++){
  8729. if (data.components[i].classification == 'skin')
  8730. continue;
  8731. objTrap[data.components[i].classification].push(data.components[i].name);
  8732. }
  8733. window.localStorage.setItem('TrapListWeapon', objTrap.weapon.join());
  8734. window.localStorage.setItem('TrapListBase', objTrap.base.join());
  8735. window.localStorage.setItem('TrapListTrinket', objTrap.trinket.join());
  8736. window.localStorage.setItem('TrapListBait', objTrap.bait.join());
  8737. },
  8738. error: function (error){
  8739. console.perror('refreshTrapList:',error);
  8740. }
  8741. });
  8742. } catch (e) {
  8743. console.perror('refreshTrapList',e.message);
  8744. }
  8745. }
  8746.  
  8747. function bodyJS(){
  8748. var objDefaultFGAR = {
  8749. order : ['FG','AR'],
  8750. weapon : new Array(2).fill(''),
  8751. base : new Array(2).fill(''),
  8752. trinket : new Array(2).fill(''),
  8753. bait : new Array(2).fill('')
  8754. };
  8755. var objDefaultBCJOD = {
  8756. order : ['JOD','LOW','MID','HIGH'],
  8757. weapon : new Array(4).fill(''),
  8758. base : new Array(4).fill(''),
  8759. trinket : new Array(4).fill(''),
  8760. bait : new Array(4).fill('')
  8761. };
  8762. var objDefaultBWRift = {
  8763. order : ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'],
  8764. master : {
  8765. weapon : new Array(32).fill('Mysteriously unYielding'),
  8766. base : new Array(32).fill('Fissure Base'),
  8767. trinket : new Array(32).fill('Rift Vacuum Charm'),
  8768. bait : new Array(32).fill('Brie String'),
  8769. activate : new Array(32).fill(false),
  8770. },
  8771. specialActivate : {
  8772. forceActivate : new Array(32).fill(false),
  8773. remainingLootActivate : new Array(32).fill(1),
  8774. forceDeactivate : new Array(32).fill(false),
  8775. remainingLootDeactivate : new Array(32).fill(1)
  8776. },
  8777. gw : {
  8778. weapon : new Array(4).fill('MASTER'),
  8779. base : new Array(4).fill('MASTER'),
  8780. trinket : new Array(4).fill('MASTER'),
  8781. bait : new Array(4).fill('MASTER'),
  8782. activate : new Array(4).fill('MASTER'),
  8783. },
  8784. al : {
  8785. weapon : new Array(4).fill('MASTER'),
  8786. base : new Array(4).fill('MASTER'),
  8787. trinket : new Array(4).fill('MASTER'),
  8788. bait : new Array(4).fill('MASTER'),
  8789. activate : new Array(4).fill('MASTER'),
  8790. },
  8791. rl : {
  8792. weapon : new Array(4).fill('MASTER'),
  8793. base : new Array(4).fill('MASTER'),
  8794. trinket : new Array(4).fill('MASTER'),
  8795. bait : new Array(4).fill('MASTER'),
  8796. activate : new Array(4).fill('MASTER'),
  8797. },
  8798. gb : {
  8799. weapon : new Array(14).fill('MASTER'),
  8800. base : new Array(14).fill('MASTER'),
  8801. trinket : new Array(14).fill('MASTER'),
  8802. bait : new Array(14).fill('MASTER'),
  8803. activate : new Array(14).fill('MASTER'),
  8804. },
  8805. ic : {
  8806. weapon : new Array(8).fill('MASTER'),
  8807. base : new Array(8).fill('MASTER'),
  8808. trinket : new Array(8).fill('MASTER'),
  8809. bait : new Array(8).fill('MASTER'),
  8810. activate : new Array(8).fill('MASTER'),
  8811. },
  8812. fa : {
  8813. weapon : new Array(32).fill('MASTER'),
  8814. base : new Array(32).fill('MASTER'),
  8815. trinket : new Array(32).fill('MASTER'),
  8816. bait : new Array(32).fill('MASTER'),
  8817. activate : new Array(32).fill('MASTER'),
  8818. },
  8819. choosePortal : false,
  8820. choosePortalAfterCC : false,
  8821. priorities : ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  8822. prioritiesCursed : ['SECURITY', 'FURNACE', 'PURSUER', 'ANCIENT', 'GEARWORKS', 'RUNIC', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  8823. minTimeSand : [70,70,50,50,50,50,40,40,999],
  8824. minRSCType : 'NUMBER',
  8825. minRSC : 0,
  8826. enterMinigameWCurse : false
  8827. };
  8828.  
  8829. function limitMinMax(value, min, max){
  8830. value = parseInt(value);
  8831. min = parseInt(min);
  8832. max = parseInt(max);
  8833. if(value < min)
  8834. value = min;
  8835. else if(value > max)
  8836. value = max;
  8837. return value;
  8838. }
  8839.  
  8840. function isNullOrUndefined(obj){
  8841. return (obj === null || obj === undefined || obj === 'null' || obj === 'undefined' || (Array.isArray(obj) && obj.length === 0));
  8842. }
  8843.  
  8844. function onIdRestoreClicked(){
  8845. var idRestore = document.getElementById('idRestore');
  8846. var inputFiles = document.getElementById('inputFiles');
  8847. if (window.FileReader) {
  8848. if(inputFiles && window.sessionStorage.getItem('bRestart') != 'true'){
  8849. inputFiles.click();
  8850. }
  8851. }
  8852. else {
  8853. alert('The File APIs are not fully supported in this browser.');
  8854. }
  8855. }
  8856.  
  8857. function handleFiles(files) {
  8858. if(files.length < 1)
  8859. return;
  8860. var reader = new FileReader();
  8861. reader.onloadend = function(evt) {
  8862. if (evt.target.readyState == FileReader.DONE) { // DONE == 2
  8863. var arr = evt.target.result.split('\r\n');
  8864. var arrSplit = [];
  8865. var bRestart = false;
  8866. var nIndex = -1;
  8867. var temp = "";
  8868. for(var i=0;i<arr.length;i++){
  8869. if(arr[i].indexOf('|') > -1){
  8870. arrSplit = arr[i].split('|');
  8871. if(arrSplit.length == 2){
  8872. nIndex = arrSplit[0].indexOf('Z');
  8873. temp = (nIndex > -1) ? arrSplit[0].substr(0,nIndex+1) : arrSplit[0];
  8874. if(Number.isNaN(Date.parse(temp))){
  8875. console.log(arrSplit);
  8876. window.localStorage.setItem(arrSplit[0], arrSplit[1]);
  8877. window.sessionStorage.setItem(arrSplit[0], arrSplit[1]);
  8878. bRestart = true;
  8879. }
  8880. }
  8881. }
  8882. }
  8883. if(bRestart){
  8884. alert('Please restart browser to take effect!');
  8885. window.sessionStorage.setItem('bRestart', 'true');
  8886. document.getElementById('idRestore').firstChild.textContent = 'Restart browser is required!';
  8887. document.getElementById('idRestore').style = "color:red";
  8888. }
  8889. else{
  8890. alert('Invalid preference file!');
  8891. }
  8892. }
  8893. };
  8894. var blob = files[0].slice(0, files[0].size);
  8895. reader.readAsText(blob);
  8896. }
  8897.  
  8898. function onIdAdsClicked(){
  8899. document.getElementById('inputShowAds').value = 'Loading Ads...';
  8900. document.getElementById('inputShowAds').disabled = 'disabled';
  8901. var xmlHttp = new XMLHttpRequest();
  8902. xmlHttp.onreadystatechange = function() {
  8903. if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
  8904. document.getElementById('inputShowAds').value = 'Click to Show Ads';
  8905. document.getElementById('inputShowAds').disabled = '';
  8906. var arr = xmlHttp.responseText.split("\r\n");
  8907. console.log(arr);
  8908. var win;
  8909. for(var i=0;i<arr.length;i++){
  8910. if(arr[i].indexOf("http") === 0){
  8911. win = window.open(arr[i]);
  8912. if(!win){
  8913. alert("Please allow popups for this site");
  8914. return;
  8915. }
  8916. }
  8917. }
  8918. }
  8919. };
  8920. xmlHttp.open("GET", "https://dl.dropboxusercontent.com/s/3cbo6en86lrpas1/Test.txt", true); // true for asynchronous
  8921. xmlHttp.send(null);
  8922. window.setTimeout(function () {
  8923. document.getElementById('inputShowAds').value = 'Click to Show Ads';
  8924. document.getElementById('inputShowAds').disabled = '';
  8925. }, 5000);
  8926. }
  8927.  
  8928. function onIdGetLogPreferenceClicked(){
  8929. var i;
  8930. var str = "";
  8931. var strKeyName = "";
  8932. var arrTimestamp = [];
  8933. var arrValue = [];
  8934. for(i=0;i<window.localStorage.length;i++){
  8935. strKeyName = window.localStorage.key(i);
  8936. if(strKeyName.indexOf('KR') === 0)
  8937. continue;
  8938. str += strKeyName + '|' + window.localStorage.getItem(strKeyName);
  8939. str += "\r\n";
  8940. }
  8941. for(i=0;i<window.sessionStorage.length;i++){
  8942. strKeyName = window.sessionStorage.key(i);
  8943. if(strKeyName.indexOf('Log_') > -1){
  8944. arrTimestamp.push(parseFloat(strKeyName.split('_')[1]));
  8945. arrValue.push(window.sessionStorage.getItem(strKeyName));
  8946. }
  8947. }
  8948. arrTimestamp = arrTimestamp.sort();
  8949. var nTimezoneOffset = -(new Date().getTimezoneOffset()) * 60000;
  8950. for(i=0;i<arrTimestamp.length;i++){
  8951. if(Number.isNaN(arrTimestamp[i]))
  8952. strKeyName = arrTimestamp[i];
  8953. else{
  8954. arrTimestamp[i] += nTimezoneOffset;
  8955. strKeyName = (new Date(arrTimestamp[i])).toISOString();
  8956. strKeyName += '.' + arrTimestamp[i].toFixed(3).split('.')[1];
  8957. }
  8958. str += strKeyName + "|" + arrValue[i];
  8959. str += "\r\n";
  8960. }
  8961. saveFile(str,'log_preference.txt');
  8962. }
  8963.  
  8964. function saveFile(content, filename){
  8965. var pom = document.createElement('a');
  8966. pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content));
  8967. pom.setAttribute('download', filename);
  8968.  
  8969. if (document.createEvent) {
  8970. var event = document.createEvent('MouseEvents');
  8971. event.initEvent('click', true, true);
  8972. pom.dispatchEvent(event);
  8973. }
  8974. else {
  8975. pom.click();
  8976. }
  8977. }
  8978.  
  8979. function onSelectSpecialFeature(){
  8980. saveSpecialFeature();
  8981. }
  8982.  
  8983. function saveSpecialFeature(){
  8984. var selectSpecialFeature = document.getElementById('selectSpecialFeature');
  8985. window.sessionStorage.setItem('SpecialFeature', selectSpecialFeature.value);
  8986. }
  8987.  
  8988. function initControlsSpecialFeature(){
  8989. var selectSpecialFeature = document.getElementById('selectSpecialFeature');
  8990. var storageValue = window.sessionStorage.getItem('SpecialFeature');
  8991. if(storageValue === null || storageValue === undefined){
  8992. storageValue = 'None';
  8993. }
  8994. selectSpecialFeature.value = storageValue;
  8995. }
  8996.  
  8997. function onSelectMapHuntingChanged(){
  8998. saveMapHunting();
  8999. initControlsMapHunting();
  9000. }
  9001.  
  9002. function saveMapHunting(){
  9003. var selectMapHunting = document.getElementById('selectMapHunting');
  9004. var selectMouseList = document.getElementById('selectMouseList');
  9005. var selectWeapon = document.getElementById('selectWeapon');
  9006. var selectBase = document.getElementById('selectBase');
  9007. var selectTrinket = document.getElementById('selectTrinket');
  9008. var selectBait = document.getElementById('selectBait');
  9009. var selectLeaveMap = document.getElementById('selectLeaveMap');
  9010. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9011. var selectCatchLogic = document.getElementById('selectCatchLogic');
  9012. var objDefaultMapHunting = {
  9013. status : false,
  9014. selectedMouse : [],
  9015. logic : 'OR',
  9016. weapon : 'Remain',
  9017. base : 'Remain',
  9018. trinket : 'Remain',
  9019. bait : 'Remain',
  9020. leave : false
  9021. };
  9022. var storageValue = JSON.parse(window.sessionStorage.getItem('MapHunting'));
  9023. if(isNullOrUndefined(storageValue))
  9024. storageValue = objDefaultMapHunting;
  9025. storageValue.status = (selectMapHunting.value == 'true');
  9026. if(inputUncaughtMouse.value === '')
  9027. storageValue.selectedMouse = [];
  9028. else
  9029. storageValue.selectedMouse = inputUncaughtMouse.value.split(',');
  9030. storageValue.logic = selectCatchLogic.value;
  9031. storageValue.weapon = selectWeapon.value;
  9032. storageValue.base = selectBase.value;
  9033. storageValue.trinket = selectTrinket.value;
  9034. storageValue.bait = selectBait.value;
  9035. storageValue.leave = (selectLeaveMap.value == 'true');
  9036. window.sessionStorage.setItem('MapHunting', JSON.stringify(storageValue));
  9037. }
  9038.  
  9039. function initControlsMapHunting(){
  9040. var trUncaughtMouse = document.getElementById('trUncaughtMouse');
  9041. var trSelectedUncaughtMouse = document.getElementById('trSelectedUncaughtMouse');
  9042. var trCatchLogic = document.getElementById('trCatchLogic');
  9043. var selectMapHunting = document.getElementById('selectMapHunting');
  9044. var selectMouseList = document.getElementById('selectMouseList');
  9045. var trMapHuntingTrapSetup = document.getElementById('trMapHuntingTrapSetup');
  9046. var trMapHuntingLeave = document.getElementById('trMapHuntingLeave');
  9047. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9048. var selectCatchLogic = document.getElementById('selectCatchLogic');
  9049. var selectWeapon = document.getElementById('selectWeapon');
  9050. var selectBase = document.getElementById('selectBase');
  9051. var selectTrinket = document.getElementById('selectTrinket');
  9052. var selectBait = document.getElementById('selectBait');
  9053. var selectLeaveMap = document.getElementById('selectLeaveMap');
  9054. var storageValue = window.sessionStorage.getItem('MapHunting');
  9055. if(isNullOrUndefined(storageValue)){
  9056. selectMapHunting.selectedIndex = 0;
  9057. trUncaughtMouse.style.display = 'none';
  9058. trMapHuntingTrapSetup.style.display = 'none';
  9059. trMapHuntingLeave.style.display = 'none';
  9060. inputUncaughtMouse.value = '';
  9061. selectCatchLogic.selectedIndex = -1;
  9062. selectWeapon.selectedIndex = -1;
  9063. selectBase.selectedIndex = -1;
  9064. selectTrinket.selectedIndex = -1;
  9065. selectBait.selectedIndex = -1;
  9066. selectLeaveMap.selectedIndex = -1;
  9067. }
  9068. else{
  9069. storageValue = JSON.parse(storageValue);
  9070. selectMapHunting.value = storageValue.status;
  9071. trUncaughtMouse.style.display = (storageValue.status) ? 'table-row' : 'none';
  9072. trSelectedUncaughtMouse.style.display = (storageValue.status) ? 'table-row' : 'none';
  9073. trCatchLogic.style.display = (storageValue.status) ? 'table-row' : 'none';
  9074. trMapHuntingTrapSetup.style.display = (storageValue.status) ? 'table-row' : 'none';
  9075. trMapHuntingLeave.style.display = (storageValue.status) ? 'table-row' : 'none';
  9076. inputUncaughtMouse.value = storageValue.selectedMouse.join(',');
  9077. selectCatchLogic.value = storageValue.logic;
  9078. selectWeapon.value = storageValue.weapon;
  9079. selectBase.value = storageValue.base;
  9080. selectTrinket.value = storageValue.trinket;
  9081. selectBait.value = storageValue.bait;
  9082. selectLeaveMap.value = storageValue.leave;
  9083. }
  9084. storageValue = window.localStorage.getItem('Last Record Uncaught');
  9085. if(!isNullOrUndefined(storageValue)){
  9086. storageValue = storageValue.split(",");
  9087. var i;
  9088. for(i = selectMouseList.options.length-1 ; i >= 0 ; i--){
  9089. selectMouseList.remove(i);
  9090. }
  9091. var optionEle;
  9092. for(i=0;i<storageValue.length;i++){
  9093. optionEle = document.createElement("option");
  9094. optionEle.setAttribute('value', storageValue[i]);
  9095. optionEle.textContent = storageValue[i];
  9096. selectMouseList.appendChild(optionEle);
  9097. }
  9098. }
  9099. document.getElementById('inputSelectMouse').disabled = (selectMouseList.options.length > 0) ? '' : 'disabled';
  9100. }
  9101.  
  9102. function onInputSelectMouse(){
  9103. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9104. var selectMouseList = document.getElementById('selectMouseList');
  9105. if(inputUncaughtMouse.value.indexOf(selectMouseList.value) < 0){
  9106. if(inputUncaughtMouse.value.length !== 0)
  9107. inputUncaughtMouse.value = selectMouseList.value + ',' + inputUncaughtMouse.value;
  9108. else
  9109. inputUncaughtMouse.value = selectMouseList.value;
  9110. }
  9111. saveMapHunting();
  9112. }
  9113.  
  9114. function onInputGetMouse(){
  9115. var classTreasureMap = document.getElementsByClassName('mousehuntHud-userStat treasureMap')[0];
  9116. if(classTreasureMap.children[2].textContent.toLowerCase().indexOf('remaining') < 0)
  9117. return;
  9118.  
  9119. document.getElementById('inputGetMouse').value = 'Processing...';
  9120. document.getElementById('inputGetMouse').disabled = 'disabled';
  9121. try {
  9122. var objData = {
  9123. sn : 'Hitgrab',
  9124. hg_is_ajax : 1,
  9125. action : 'info',
  9126. uh : user.unique_hash
  9127. };
  9128.  
  9129. jQuery.ajax({
  9130. type: 'POST',
  9131. url: '/managers/ajax/users/relichunter.php',
  9132. data: objData,
  9133. contentType: 'application/x-www-form-urlencoded',
  9134. dataType: 'json',
  9135. xhrFields: {
  9136. withCredentials: false
  9137. },
  9138. success: function (data){
  9139. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9140. document.getElementById('inputGetMouse').disabled = '';
  9141. console.log(data.treasure_map);
  9142. if(data.treasure_map.groups !== null && data.treasure_map.groups !== undefined){
  9143. var arrUncaught = [];
  9144. for(var i=0;i<data.treasure_map.groups.length;i++){
  9145. if(data.treasure_map.groups[i].is_uncaught === true){
  9146. for(var j=0;j<data.treasure_map.groups[i].mice.length;j++){
  9147. arrUncaught.push(data.treasure_map.groups[i].mice[j].name);
  9148. }
  9149. }
  9150. }
  9151. window.localStorage.setItem('Last Record Uncaught', arrUncaught.join(","));
  9152. initControlsMapHunting();
  9153. }
  9154. },
  9155. error: function (error){
  9156. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9157. document.getElementById('inputGetMouse').disabled = '';
  9158. console.error('onInputGetMouse ajax:',error);
  9159. }
  9160. });
  9161. }
  9162. catch (e) {
  9163. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9164. document.getElementById('inputGetMouse').disabled = '';
  9165. console.error('onInputGetMouse',e.message);
  9166. }
  9167. }
  9168.  
  9169. function onInputClearUncaughtMouse(){
  9170. document.getElementById('inputUncaughtMouse').value = "";
  9171. saveMapHunting();
  9172. }
  9173.  
  9174. 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'];
  9175. function setLocalToSession(){
  9176. var i, j, key;
  9177. for(i=0;i<window.localStorage.length;i++){
  9178. key = window.localStorage.key(i);
  9179. for(j=0;j<arrKey.length;j++){
  9180. if(key.indexOf(arrKey[j]) > -1){
  9181. window.sessionStorage.setItem(key, window.localStorage.getItem(key));
  9182. break;
  9183. }
  9184. }
  9185. }
  9186. }
  9187.  
  9188. function setSessionToLocal(){
  9189. if(window.sessionStorage.length===0)
  9190. return;
  9191.  
  9192. var i, j, key;
  9193. for(i=0;i<window.sessionStorage.length;i++){
  9194. key = window.sessionStorage.key(i);
  9195. for(j=0;j<arrKey.length;j++){
  9196. if(key.indexOf(arrKey[j]) > -1){
  9197. window.localStorage.setItem(key, window.sessionStorage.getItem(key));
  9198. break;
  9199. }
  9200. }
  9201. }
  9202. }
  9203.  
  9204. function onInputResetReload(){
  9205. var strValue = document.getElementById('eventAlgo').value;
  9206. var keyName;
  9207. if(strValue == 'Burroughs Rift Custom') keyName = 'BRCustom';
  9208. else if(strValue == 'All LG Area') keyName = 'LGArea';
  9209. else if(strValue == 'SG') keyName = 'SGarden';
  9210. else if(strValue == 'ZT') keyName = 'ZTower';
  9211. else if(strValue == 'Sunken City Custom') keyName = 'SCCustom';
  9212. else if(strValue == 'Labyrinth') keyName = 'Labyrinth';
  9213. else if(strValue == 'Zokor') keyName = 'Zokor';
  9214. else if(strValue == 'Fiery Warpath') keyName = 'FW';
  9215. else if(strValue == 'Furoma Rift') keyName = 'FRift';
  9216. else if(strValue == 'Iceberg') keyName = 'Iceberg';
  9217. else if(strValue == 'WWRift') keyName = 'WWRift';
  9218. else if(strValue == 'GES') keyName = 'GES';
  9219. else if(strValue == 'Fort Rox') keyName = 'FRox';
  9220. else if(strValue == 'GWH2016R') keyName = 'GWH2016R';
  9221. else if(strValue == 'Bristle Woods Rift') keyName = 'BWRift';
  9222. else if(strValue == 'BC/JOD') keyName = 'BC_JOD';
  9223. else if(strValue == 'FG/AR') keyName = 'FG_AR';
  9224.  
  9225. if(!isNullOrUndefined(keyName)){
  9226. window.sessionStorage.removeItem(keyName);
  9227. window.localStorage.removeItem(keyName);
  9228. }
  9229. }
  9230.  
  9231. function initControlsBestTrap(){
  9232. var selectBestTrapPowerType = document.getElementById('selectBestTrapPowerType');
  9233. var selectBestTrapWeapon = document.getElementById('selectBestTrapWeapon');
  9234. var selectBestTrapBaseType = document.getElementById('selectBestTrapBaseType');
  9235. var selectBestTrapBase = document.getElementById('selectBestTrapBase');
  9236. var storageValue = window.sessionStorage.getItem('BestTrap');
  9237. if (isNullOrUndefined(storageValue)){
  9238. selectBestTrapWeapon.selectedIndex = -1;
  9239. selectBestTrapBase.selectedIndex = -1;
  9240. }
  9241. else{
  9242. storageValue = JSON.parse(storageValue);
  9243. selectBestTrapWeapon.value = storageValue.weapon[selectBestTrapPowerType.value];
  9244. selectBestTrapBase.value = storageValue.base[selectBestTrapBaseType.value];
  9245. }
  9246. }
  9247.  
  9248. function saveBestTrap(){
  9249. var selectBestTrapPowerType = document.getElementById('selectBestTrapPowerType');
  9250. var selectBestTrapWeapon = document.getElementById('selectBestTrapWeapon');
  9251. var selectBestTrapBaseType = document.getElementById('selectBestTrapBaseType');
  9252. var selectBestTrapBase = document.getElementById('selectBestTrapBase');
  9253. var storageValue = window.sessionStorage.getItem('BestTrap');
  9254. if (isNullOrUndefined(storageValue)){
  9255. var objBestTrapDefault = {
  9256. weapon : {
  9257. arcane : '',
  9258. draconic : '',
  9259. forgotten : '',
  9260. hydro : '',
  9261. law : '',
  9262. physical : '',
  9263. rift : '',
  9264. shadow : '',
  9265. tactical : ''
  9266. },
  9267. base : {
  9268. luck : '',
  9269. power : ''
  9270. }
  9271. };
  9272. storageValue = JSON.stringify(objBestTrapDefault);
  9273. }
  9274.  
  9275. storageValue = JSON.parse(storageValue);
  9276. storageValue.weapon[selectBestTrapPowerType.value] = selectBestTrapWeapon.value;
  9277. storageValue.base[selectBestTrapBaseType.value] = selectBestTrapBase.value;
  9278. window.sessionStorage.setItem('BestTrap', JSON.stringify(storageValue));
  9279. }
  9280.  
  9281. function onInputMinAAChanged(input){
  9282. input.value = limitMinMax(input.value, input.min, input.max);
  9283. saveGWH2016();
  9284. }
  9285.  
  9286. function onInputMinWorkChanged(input){
  9287. input.value = limitMinMax(input.value, input.min, input.max);
  9288. saveGWH2016();
  9289. }
  9290.  
  9291. function onSelectGWHTrinketChanged(){
  9292. saveGWH2016();
  9293. initControlsGWH2016();
  9294. }
  9295.  
  9296. function initControlsGWH2016(bAutoChangeZone){
  9297. if(isNullOrUndefined(bAutoChangeZone))
  9298. bAutoChangeZone = false;
  9299. var selectGWHZone = document.getElementById('selectGWHZone');
  9300. var selectGWHWeapon = document.getElementById('selectGWHWeapon');
  9301. var selectGWHBase = document.getElementById('selectGWHBase');
  9302. var selectGWHTrinket = document.getElementById('selectGWHTrinket');
  9303. var selectGWHBait = document.getElementById('selectGWHBait');
  9304. var selectGWHBoost = document.getElementById('selectGWHBoost');
  9305. var selectGWHUseTurboBoost = document.getElementById('selectGWHUseTurboBoost');
  9306. var inputMinAA = document.getElementById('inputMinAA');
  9307. var inputMinFirework = document.getElementById('inputMinFirework');
  9308. var selectGWHLandAfterRunOutFirework = document.getElementById('selectGWHLandAfterRunOutFirework');
  9309. var storageValue = window.sessionStorage.getItem('GWH2016R');
  9310. if(isNullOrUndefined(storageValue)){
  9311. selectGWHWeapon.selectedIndex = -1;
  9312. selectGWHBase.selectedIndex = -1;
  9313. selectGWHTrinket.selectedIndex = -1;
  9314. selectGWHBait.selectedIndex = -1;
  9315. selectGWHBoost.selectedIndex = -1;
  9316. selectGWHUseTurboBoost.selectedIndex = 0;
  9317. inputMinAA.value = 20;
  9318. inputMinFirework.value = 20;
  9319. selectGWHLandAfterRunOutFirework.selectedIndex = 0;
  9320. }
  9321. else{
  9322. storageValue = JSON.parse(storageValue);
  9323. var nIndex = storageValue.zone.indexOf(selectGWHZone.value);
  9324. selectGWHWeapon.value = storageValue.weapon[nIndex];
  9325. selectGWHBase.value = storageValue.base[nIndex];
  9326. selectGWHTrinket.value = storageValue.trinket[nIndex];
  9327. selectGWHBait.value = storageValue.bait[nIndex];
  9328. selectGWHBoost.value = (storageValue.boost[nIndex] === true) ? 'true' : 'false';
  9329. selectGWHBoost.disabled = (selectGWHTrinket.value.toUpperCase().indexOf('ANCHOR') > -1) ? 'disabled' : '';
  9330. selectGWHUseTurboBoost.value = (storageValue.turbo === true) ? 'true' : 'false';
  9331. inputMinAA.value = storageValue.minAAToFly;
  9332. inputMinFirework.value = storageValue.minFireworkToFly;
  9333. selectGWHLandAfterRunOutFirework.value = (storageValue.landAfterFireworkRunOut === true) ? 'true' : 'false';
  9334. }
  9335. }
  9336.  
  9337. function saveGWH2016(){
  9338. var selectGWHZone = document.getElementById('selectGWHZone');
  9339. var selectGWHWeapon = document.getElementById('selectGWHWeapon');
  9340. var selectGWHBase = document.getElementById('selectGWHBase');
  9341. var selectGWHTrinket = document.getElementById('selectGWHTrinket');
  9342. var selectGWHBait = document.getElementById('selectGWHBait');
  9343. var selectGWHBoost = document.getElementById('selectGWHBoost');
  9344. var selectGWHUseTurboBoost = document.getElementById('selectGWHUseTurboBoost');
  9345. var inputMinAA = document.getElementById('inputMinAA');
  9346. var inputMinFirework = document.getElementById('inputMinFirework');
  9347. var selectGWHLandAfterRunOutFirework = document.getElementById('selectGWHLandAfterRunOutFirework');
  9348. var storageValue = window.sessionStorage.getItem('GWH2016R');
  9349. if(isNullOrUndefined(storageValue)){
  9350. var objDefaultGWH2016 = {
  9351. zone : ['ORDER1','ORDER2','NONORDER1','NONORDER2','WINTER_WASTELAND','SNOWBALL_STORM','FLYING','NEW_YEAR\'S_PARTY'],
  9352. weapon : new Array(8).fill(''),
  9353. base : new Array(8).fill(''),
  9354. trinket : new Array(8).fill(''),
  9355. bait : new Array(8).fill(''),
  9356. boost : new Array(8).fill(false),
  9357. turbo : false,
  9358. minAAToFly : 20,
  9359. minFireworkToFly : 20,
  9360. landAfterFireworkRunOut : false
  9361. };
  9362. storageValue = JSON.stringify(objDefaultGWH2016);
  9363. }
  9364. storageValue = JSON.parse(storageValue);
  9365. var nIndex = storageValue.zone.indexOf(selectGWHZone.value);
  9366. storageValue.weapon[nIndex] = selectGWHWeapon.value;
  9367. storageValue.base[nIndex] = selectGWHBase.value;
  9368. storageValue.trinket[nIndex] = selectGWHTrinket.value;
  9369. storageValue.bait[nIndex] = selectGWHBait.value;
  9370. storageValue.boost[nIndex] = (selectGWHTrinket.value.toUpperCase().indexOf('ANCHOR') > -1) ? false : (selectGWHBoost.value == 'true');
  9371. storageValue.turbo = (selectGWHUseTurboBoost.value == 'true');
  9372. storageValue.minAAToFly = parseInt(inputMinAA.value);
  9373. storageValue.minFireworkToFly = parseInt(inputMinFirework.value);
  9374. storageValue.landAfterFireworkRunOut = (selectGWHLandAfterRunOutFirework.value == 'true');
  9375. window.sessionStorage.setItem('GWH2016R', JSON.stringify(storageValue));
  9376. }
  9377.  
  9378. function initControlsSCCustom(bAutoChangeZone){
  9379. if(isNullOrUndefined(bAutoChangeZone))
  9380. bAutoChangeZone = false;
  9381. var selectSCHuntZone = document.getElementById('selectSCHuntZone');
  9382. var selectSCHuntZoneEnable = document.getElementById('selectSCHuntZoneEnable');
  9383. var selectSCHuntBait = document.getElementById('selectSCHuntBait');
  9384. var selectSCHuntTrinket = document.getElementById('selectSCHuntTrinket');
  9385. var selectSCUseSmartJet = document.getElementById('selectSCUseSmartJet');
  9386. var storageValue = window.sessionStorage.getItem('SCCustom');
  9387. if(isNullOrUndefined(storageValue)){
  9388. var objDefaultSCCustom = {
  9389. 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'],
  9390. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  9391. isHunt : new Array(11).fill(true),
  9392. bait : new Array(11).fill('Gouda'),
  9393. trinket : new Array(11).fill('None'),
  9394. useSmartJet : false
  9395. };
  9396. storageValue = JSON.stringify(objDefaultSCCustom);
  9397. }
  9398.  
  9399. storageValue = JSON.parse(storageValue);
  9400. if(bAutoChangeZone && !isNullOrUndefined(user) && user.location.indexOf('Sunken City') > -1){
  9401. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  9402. var objZone = {
  9403. 'ZONE_TREASURE' : ['Sand Dollar Sea Bar', 'Pearl Patch', 'Sunken Treasure'],
  9404. 'ZONE_DANGER' : ['Feeding Grounds', 'Carnivore Cove'],
  9405. 'ZONE_DANGER_PP' : ['Monster Trench'],
  9406. 'ZONE_DANGER_PP_LOTA' : ['Lair of the Ancients'],
  9407. 'ZONE_OXYGEN' : ['Deep Oxygen Stream', 'Oxygen Stream'],
  9408. 'ZONE_BONUS' : ['Magma Flow'],
  9409. 'ZONE_CORAL' : ['Coral Reef', 'Coral Garden', 'Coral Castle'],
  9410. 'ZONE_SCALE' : ['School of Mice', 'Mermouse Den', 'Lost Ruins'],
  9411. 'ZONE_BARNACLE' : ['Rocky Outcrop', 'Shipwreck', 'Haunted Shipwreck'],
  9412. 'ZONE_DEFAULT' : ['Shallow Shoals', 'Sea Floor', 'Murky Depths'],
  9413. };
  9414. selectSCHuntZone.selectedIndex = 0;
  9415. for(var prop in objZone){
  9416. if(objZone.hasOwnProperty(prop)){
  9417. if(objZone[prop].indexOf(zone) > -1){
  9418. selectSCHuntZone.value = prop;
  9419. break;
  9420. }
  9421. }
  9422. }
  9423. }
  9424. var nIndex = storageValue.zone.indexOf(selectSCHuntZone.value);
  9425. if(nIndex < 0)
  9426. nIndex = 0;
  9427. selectSCHuntZoneEnable.value = storageValue.isHunt[nIndex];
  9428. selectSCHuntBait.value = storageValue.bait[nIndex];
  9429. selectSCHuntTrinket.value = storageValue.trinket[nIndex];
  9430. selectSCUseSmartJet.value = storageValue.useSmartJet;
  9431. selectSCHuntZoneEnable.style.display = (selectSCHuntZone.value == 'ZONE_NOT_DIVE') ? 'none' : '';
  9432. }
  9433.  
  9434. function saveSCCustomAlgo(){
  9435. var selectSCHuntZone = document.getElementById('selectSCHuntZone');
  9436. var selectSCHuntZoneEnable = document.getElementById('selectSCHuntZoneEnable');
  9437. var selectSCHuntBait = document.getElementById('selectSCHuntBait');
  9438. var selectSCHuntTrinket = document.getElementById('selectSCHuntTrinket');
  9439. var selectSCUseSmartJet = document.getElementById('selectSCUseSmartJet');
  9440. var storageValue = window.sessionStorage.getItem('SCCustom');
  9441. if(isNullOrUndefined(storageValue)){
  9442. var objDefaultSCCustom = {
  9443. 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'],
  9444. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  9445. isHunt : new Array(11).fill(true),
  9446. bait : new Array(11).fill('Gouda'),
  9447. trinket : new Array(11).fill('None'),
  9448. useSmartJet : false
  9449. };
  9450. storageValue = JSON.stringify(objDefaultSCCustom);
  9451. }
  9452.  
  9453. storageValue = JSON.parse(storageValue);
  9454. var nIndex = storageValue.zone.indexOf(selectSCHuntZone.value);
  9455. if(nIndex < 0)
  9456. nIndex = 0;
  9457. storageValue.isHunt[nIndex] = (selectSCHuntZoneEnable.value === 'true');
  9458. storageValue.bait[nIndex] = selectSCHuntBait.value;
  9459. storageValue.trinket[nIndex] = selectSCHuntTrinket.value;
  9460. storageValue.useSmartJet = (selectSCUseSmartJet.value === 'true');
  9461. window.sessionStorage.setItem('SCCustom', JSON.stringify(storageValue));
  9462. }
  9463.  
  9464. function onSelectLabyrinthDistrict(){
  9465. saveLaby();
  9466. initControlsLaby();
  9467. }
  9468.  
  9469. function onSelectLabyrinthDisarm(){
  9470. var inputLabyrinthLastHunt = document.getElementById('inputLabyrinthLastHunt');
  9471. var selectLabyrinthDisarm = document.getElementById('selectLabyrinthDisarm');
  9472. inputLabyrinthLastHunt.disabled = (selectLabyrinthDisarm.value == 'true') ? '' : 'disabled';
  9473. saveLaby();
  9474. }
  9475.  
  9476. function onInputLabyrinthLastHuntChanged(input){
  9477. input.value = limitMinMax(input.value, input.min, input.max);
  9478. saveLaby();
  9479. }
  9480.  
  9481. function onSelectLabyrinthDisarmCompass(){
  9482. saveLaby();
  9483. initControlsLaby();
  9484. }
  9485.  
  9486. function onInputLabyrinthDECChanged(input){
  9487. input.value = limitMinMax(input.value, input.min, input.max);
  9488. saveLaby();
  9489. }
  9490.  
  9491. function saveLaby(){
  9492. var selectLabyrinthDistrict = document.getElementById('selectLabyrinthDistrict');
  9493. var selectHallway15Plain = document.getElementById('selectHallway15Plain');
  9494. var selectHallway1560Plain = document.getElementById('selectHallway1560Plain');
  9495. var selectHallway1560Superior = document.getElementById('selectHallway1560Superior');
  9496. var selectHallway60Plain = document.getElementById('selectHallway60Plain');
  9497. var selectHallway60Superior = document.getElementById('selectHallway60Superior');
  9498. var selectHallway60Epic = document.getElementById('selectHallway60Epic');
  9499. var selectLabyrinthOtherBase = document.getElementById('selectLabyrinthOtherBase');
  9500. var inputLabyrinthDEC = document.getElementById('inputLabyrinthDEC');
  9501. var selectLabyrinthDisarmCompass = document.getElementById('selectLabyrinthDisarmCompass');
  9502. var selectLabyrinthWeaponType = document.getElementById('selectLabyrinthWeaponType');
  9503. var storageValue = window.sessionStorage.getItem('Labyrinth');
  9504. if(isNullOrUndefined(storageValue)){
  9505. var objDefaultLaby = {
  9506. districtFocus : 'None',
  9507. between0and14 : ['LP'],
  9508. between15and59 : ['SP','LS'],
  9509. between60and100 : ['SP','SS','LE'],
  9510. chooseOtherDoors : false,
  9511. typeOtherDoors : "SHORTEST_ONLY",
  9512. securityDisarm : false,
  9513. lastHunt : 0,
  9514. armOtherBase : 'false',
  9515. disarmCompass : true,
  9516. nDeadEndClue : 0,
  9517. weaponFarming : 'Forgotten'
  9518. };
  9519. storageValue = JSON.stringify(objDefaultLaby);
  9520. }
  9521.  
  9522. storageValue = JSON.parse(storageValue);
  9523. storageValue.districtFocus = selectLabyrinthDistrict.value;
  9524. storageValue.between0and14 = [selectHallway15Plain.value];
  9525. storageValue.between15and59 = [selectHallway1560Plain.value, selectHallway1560Superior.value];
  9526. storageValue.between60and100 = [selectHallway60Plain.value, selectHallway60Superior.value, selectHallway60Epic.value];
  9527. storageValue.chooseOtherDoors = (document.getElementById('chooseOtherDoors').value == 'true');
  9528. storageValue.typeOtherDoors = document.getElementById('typeOtherDoors').value;
  9529. storageValue.securityDisarm = (document.getElementById('selectLabyrinthDisarm').value == 'true');
  9530. storageValue.lastHunt = parseInt(document.getElementById('inputLabyrinthLastHunt').value);
  9531. storageValue.armOtherBase = selectLabyrinthOtherBase.value;
  9532. storageValue.disarmCompass = (selectLabyrinthDisarmCompass.value == 'true');
  9533. storageValue.nDeadEndClue = parseInt(inputLabyrinthDEC.value);
  9534. storageValue.weaponFarming = selectLabyrinthWeaponType.value;
  9535. window.sessionStorage.setItem('Labyrinth', JSON.stringify(storageValue));
  9536. }
  9537.  
  9538. function initControlsLaby(){
  9539. var selectLabyrinthDistrict = document.getElementById('selectLabyrinthDistrict');
  9540. var inputLabyrinthLastHunt = document.getElementById('inputLabyrinthLastHunt');
  9541. var selectLabyrinthDisarm = document.getElementById('selectLabyrinthDisarm');
  9542. var selectHallway15Plain = document.getElementById('selectHallway15Plain');
  9543. var selectHallway1560Plain = document.getElementById('selectHallway1560Plain');
  9544. var selectHallway1560Superior = document.getElementById('selectHallway1560Superior');
  9545. var selectHallway60Plain = document.getElementById('selectHallway60Plain');
  9546. var selectHallway60Superior = document.getElementById('selectHallway60Superior');
  9547. var selectHallway60Epic = document.getElementById('selectHallway60Epic');
  9548. var selectChooseOtherDoors = document.getElementById('chooseOtherDoors');
  9549. var typeOtherDoors = document.getElementById('typeOtherDoors');
  9550. var selectLabyrinthOtherBase = document.getElementById('selectLabyrinthOtherBase');
  9551. var selectLabyrinthDisarmCompass = document.getElementById('selectLabyrinthDisarmCompass');
  9552. var inputLabyrinthDEC = document.getElementById('inputLabyrinthDEC');
  9553. var selectLabyrinthWeaponType = document.getElementById('selectLabyrinthWeaponType');
  9554. var storageValue = window.sessionStorage.getItem('Labyrinth');
  9555. if(isNullOrUndefined(storageValue)){
  9556. selectLabyrinthDistrict.selectedIndex = -1;
  9557. inputLabyrinthLastHunt.value = 2;
  9558. selectLabyrinthDisarm.selectedIndex = -1;
  9559. selectHallway15Plain.selectedIndex = -1;
  9560. selectHallway1560Plain.selectedIndex = -1;
  9561. selectHallway1560Superior.selectedIndex = -1;
  9562. selectHallway60Plain.selectedIndex = -1;
  9563. selectHallway60Superior.selectedIndex = -1;
  9564. selectHallway60Epic.selectedIndex = -1;
  9565. selectChooseOtherDoors.selectedIndex = -1;
  9566. typeOtherDoors.selectedIndex = -1;
  9567. selectLabyrinthOtherBase.selectedIndex = -1;
  9568. selectLabyrinthDisarmCompass.selectedIndex = -1;
  9569. inputLabyrinthDEC.value = 0;
  9570. selectLabyrinthWeaponType.selectedIndex = 0;
  9571. }
  9572. else{
  9573. storageValue = JSON.parse(storageValue);
  9574. selectLabyrinthDistrict.value = storageValue.districtFocus;
  9575. inputLabyrinthLastHunt.value = storageValue.lastHunt;
  9576. selectLabyrinthDisarm.value = (storageValue.securityDisarm) ? 'true' : 'false';
  9577. selectHallway15Plain.value = storageValue.between0and14[0];
  9578. selectHallway1560Plain.value = storageValue.between15and59[0];
  9579. selectHallway1560Superior.value = storageValue.between15and59[1];
  9580. selectHallway60Plain.value = storageValue.between60and100[0];
  9581. selectHallway60Superior.value = storageValue.between60and100[1];
  9582. selectHallway60Epic.value = storageValue.between60and100[2];
  9583. selectChooseOtherDoors.value = (storageValue.chooseOtherDoors) ? 'true' : 'false';
  9584. typeOtherDoors.value = storageValue.typeOtherDoors;
  9585. selectLabyrinthOtherBase.value = storageValue.armOtherBase;
  9586. selectLabyrinthDisarmCompass.value = (storageValue.disarmCompass) ? 'true' : 'false';
  9587. inputLabyrinthDEC.value = storageValue.nDeadEndClue;
  9588. selectLabyrinthWeaponType.value = storageValue.weaponFarming;
  9589. }
  9590. inputLabyrinthLastHunt.disabled = (storageValue.securityDisarm) ? '' : 'disabled';
  9591. document.getElementById('trPriorities15').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9592. document.getElementById('trPriorities1560').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9593. document.getElementById('trPriorities60').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9594. document.getElementById('trLabyrinthOtherHallway').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9595. inputLabyrinthDEC.disabled = (storageValue.disarmCompass) ? '' : 'disabled';
  9596. selectHallway60Epic.style = (selectLabyrinthDistrict.value == 'TREASURY' || selectLabyrinthDistrict.value == 'FARMING') ? 'display:none' : 'display:inline';
  9597. document.getElementById('typeOtherDoors').disabled = (storageValue.chooseOtherDoors)? '' : 'disabled';
  9598. }
  9599.  
  9600. function saveLG(){
  9601. var selectLGTGAutoFillSide = document.getElementById('selectLGTGAutoFillSide');
  9602. var selectLGTGAutoFillState = document.getElementById('selectLGTGAutoFillState');
  9603. var selectLGTGAutoPourSide = document.getElementById('selectLGTGAutoPourSide');
  9604. var selectLGTGAutoPourState = document.getElementById('selectLGTGAutoPourState');
  9605. var selectLGTGSide = document.getElementById('selectLGTGSide');
  9606. var selectLGTGBase = document.getElementById('selectLGTGBase');
  9607. var selectLGTGTrinket = document.getElementById('selectLGTGTrinket');
  9608. var selectLGTGBait = document.getElementById('selectLGTGBait');
  9609. var selectLCCCSide = document.getElementById('selectLCCCSide');
  9610. var selectLCCCBase = document.getElementById('selectLCCCBase');
  9611. var selectLCCCTrinket = document.getElementById('selectLCCCTrinket');
  9612. var selectSaltedStatus = document.getElementById('selectSaltedStatus');
  9613. var selectSCBase = document.getElementById('selectSCBase');
  9614. var inputKGSalt = document.getElementById('inputKGSalt');
  9615. var storageValue = window.sessionStorage.getItem('LGArea');
  9616. if(isNullOrUndefined(storageValue)){
  9617. var objLGTemplate = {
  9618. isAutoFill : false,
  9619. isAutoPour : false,
  9620. maxSaltCharged : 25,
  9621. base : {
  9622. before : '',
  9623. after : ''
  9624. },
  9625. trinket : {
  9626. before : '',
  9627. after : ''
  9628. },
  9629. bait : {
  9630. before : '',
  9631. after : ''
  9632. }
  9633. };
  9634. var objAllLG = {
  9635. LG : JSON.parse(JSON.stringify(objLGTemplate)),
  9636. TG : JSON.parse(JSON.stringify(objLGTemplate)),
  9637. LC : JSON.parse(JSON.stringify(objLGTemplate)),
  9638. CC : JSON.parse(JSON.stringify(objLGTemplate)),
  9639. SD : JSON.parse(JSON.stringify(objLGTemplate)),
  9640. SC : JSON.parse(JSON.stringify(objLGTemplate)),
  9641. };
  9642. storageValue = JSON.stringify(objAllLG);
  9643. }
  9644. storageValue = JSON.parse(storageValue);
  9645. storageValue[selectLGTGAutoFillSide.value].isAutoFill = (selectLGTGAutoFillState.value == 'true');
  9646. storageValue[selectLGTGAutoPourSide.value].isAutoPour = (selectLGTGAutoPourState.value == 'true');
  9647. storageValue[selectLGTGSide.value].base.after = selectLGTGBase.value;
  9648. storageValue[selectLGTGSide.value].base.after = selectLGTGBase.value;
  9649. storageValue[selectLGTGSide.value].trinket.after = selectLGTGTrinket.value;
  9650. storageValue[selectLGTGSide.value].bait.after = selectLGTGBait.value;
  9651. storageValue[selectLCCCSide.value].base.after = selectLCCCBase.value;
  9652. storageValue[selectLCCCSide.value].trinket.after = selectLCCCTrinket.value;
  9653. storageValue.SC.base[selectSaltedStatus.value] = selectSCBase.value;
  9654. storageValue.SC.maxSaltCharged = inputKGSalt.value;
  9655. window.sessionStorage.setItem('LGArea', JSON.stringify(storageValue));
  9656. }
  9657.  
  9658. function initControlsLG(bAutoChangeLocation){
  9659. if(isNullOrUndefined(bAutoChangeLocation))
  9660. bAutoChangeLocation = false;
  9661. var selectLGTGAutoFillSide = document.getElementById('selectLGTGAutoFillSide');
  9662. var selectLGTGAutoFillState = document.getElementById('selectLGTGAutoFillState');
  9663. var selectLGTGAutoPourSide = document.getElementById('selectLGTGAutoPourSide');
  9664. var selectLGTGAutoPourState = document.getElementById('selectLGTGAutoPourState');
  9665. var selectLGTGSide = document.getElementById('selectLGTGSide');
  9666. var selectLGTGBase = document.getElementById('selectLGTGBase');
  9667. var selectLGTGTrinket = document.getElementById('selectLGTGTrinket');
  9668. var selectLGTGBait = document.getElementById('selectLGTGBait');
  9669. var selectLCCCSide = document.getElementById('selectLCCCSide');
  9670. var selectLCCCBase = document.getElementById('selectLCCCBase');
  9671. var selectLCCCTrinket = document.getElementById('selectLCCCTrinket');
  9672. var selectSaltedStatus = document.getElementById('selectSaltedStatus');
  9673. var selectSCBase = document.getElementById('selectSCBase');
  9674. var inputKGSalt = document.getElementById('inputKGSalt');
  9675. var storageValue = window.sessionStorage.getItem('LGArea');
  9676. if(isNullOrUndefined(storageValue)){
  9677. selectLGTGAutoFillState.selectedIndex = -1;
  9678. selectLGTGAutoPourState.selectedIndex = -1;
  9679. selectLGTGBase.selectedIndex = -1;
  9680. selectLGTGTrinket.selectedIndex = -1;
  9681. selectLGTGBait.selectedIndex = -1;
  9682. selectLCCCBase.selectedIndex = -1;
  9683. selectLCCCTrinket.selectedIndex = -1;
  9684. selectSCBase.selectedIndex = -1;
  9685. inputKGSalt.value = 25;
  9686. }
  9687. else{
  9688. storageValue = JSON.parse(storageValue);
  9689. if(bAutoChangeLocation && !isNullOrUndefined(user)){
  9690. if(user.location.indexOf('Living Garden') > -1){
  9691. selectLGTGAutoFillSide.value = 'LG';
  9692. selectLGTGAutoPourSide.value = 'LG';
  9693. selectLGTGSide.value = 'LG';
  9694. }
  9695. else if(user.location.indexOf('Twisted Garden') > -1){
  9696. selectLGTGAutoFillSide.value = 'TG';
  9697. selectLGTGAutoPourSide.value = 'TG';
  9698. selectLGTGSide.value = 'TG';
  9699. }
  9700. else if(user.location.indexOf('Lost City') > -1){
  9701. selectLCCCSide.value = 'LC';
  9702. }
  9703. else if(user.location.indexOf('Cursed City') > -1){
  9704. selectLCCCSide.value = 'CC';
  9705. }
  9706. }
  9707. selectLGTGAutoFillState.value = storageValue[selectLGTGAutoFillSide.value].isAutoFill;
  9708. selectLGTGAutoPourState.value = storageValue[selectLGTGAutoPourSide.value].isAutoPour;
  9709. selectLGTGBase.value = storageValue[selectLGTGSide.value].base.after;
  9710. selectLGTGTrinket.value = storageValue[selectLGTGSide.value].trinket.after;
  9711. selectLGTGBait.value = storageValue[selectLGTGSide.value].bait.after;
  9712. selectLCCCBase.value = storageValue[selectLCCCSide.value].base.after;
  9713. selectLCCCTrinket.value = storageValue[selectLCCCSide.value].trinket.after;
  9714. selectSCBase.value = storageValue.SC.base[selectSaltedStatus.value];
  9715. inputKGSalt.value = storageValue.SC.maxSaltCharged;
  9716. }
  9717. }
  9718.  
  9719. function initControlsFW(bAutoChangeWave){
  9720. if(isNullOrUndefined(bAutoChangeWave))
  9721. bAutoChangeWave = false;
  9722. var selectFWWave = document.getElementById('selectFWWave');
  9723. var selectFWTrapSetupWeapon = document.getElementById('selectFWTrapSetupWeapon');
  9724. var selectFWTrapSetupBase = document.getElementById('selectFWTrapSetupBase');
  9725. var selectFWStreak = document.getElementById('selectFWStreak');
  9726. var selectFWFocusType = document.getElementById('selectFWFocusType');
  9727. var selectFWPriorities = document.getElementById('selectFWPriorities');
  9728. var selectFWCheese = document.getElementById('selectFWCheese');
  9729. var selectFWCharmType = document.getElementById('selectFWCharmType');
  9730. var selectFWSpecial = document.getElementById('selectFWSpecial');
  9731. var selectFWLastTypeConfig = document.getElementById('selectFWLastTypeConfig');
  9732. var selectFWLastTypeConfigIncludeArtillery = document.getElementById('selectFWLastTypeConfigIncludeArtillery');
  9733. var selectFWSupportConfig = document.getElementById('selectFWSupportConfig');
  9734. var selectFW4WardenStatus = document.getElementById('selectFW4WardenStatus');
  9735. var selectFW4TrapSetupWeapon = document.getElementById('selectFW4TrapSetupWeapon');
  9736. var selectFW4TrapSetupBase = document.getElementById('selectFW4TrapSetupBase');
  9737. var selectFW4TrapSetupTrinket = document.getElementById('selectFW4TrapSetupTrinket');
  9738. var selectFW4TrapSetupBait = document.getElementById('selectFW4TrapSetupBait');
  9739. var storageValue = window.sessionStorage.getItem('FW');
  9740. if(isNullOrUndefined(storageValue)){
  9741. selectFWTrapSetupWeapon.selectedIndex = -1;
  9742. selectFWTrapSetupBase.selectedIndex = -1;
  9743. selectFW4TrapSetupWeapon.selectedIndex = -1;
  9744. selectFW4TrapSetupBase.selectedIndex = -1;
  9745. selectFW4TrapSetupTrinket.selectedIndex = -1;
  9746. selectFW4TrapSetupBait.selectedIndex = -1;
  9747. selectFWFocusType.selectedIndex = -1;
  9748. selectFWPriorities.selectedIndex = -1;
  9749. selectFWCheese.selectedIndex = -1;
  9750. selectFWCharmType.selectedIndex = -1;
  9751. selectFWSpecial.selectedIndex = -1;
  9752. selectFWLastTypeConfig.selectedIndex = -1;
  9753. selectFWLastTypeConfigIncludeArtillery.selectedIndex = 0;
  9754. selectFWSupportConfig.selectedIndex = 0;
  9755. }
  9756. else{
  9757. storageValue = JSON.parse(storageValue);
  9758. if(bAutoChangeWave && !isNullOrUndefined(user) && user.location.indexOf('Fiery Warpath') > -1){
  9759. if(user.viewing_atts.desert_warpath.wave < 1)
  9760. selectFWWave.value = 1;
  9761. else if(user.viewing_atts.desert_warpath.wave > 4)
  9762. selectFWWave.value = 4;
  9763. else
  9764. selectFWWave.value = user.viewing_atts.desert_warpath.wave;
  9765.  
  9766. var nStreak = parseInt(user.viewing_atts.desert_warpath.streak_quantity);
  9767. if(Number.isInteger(nStreak)){
  9768. if(nStreak !== 0)
  9769. selectFWStreak.value = nStreak+1;
  9770. }
  9771. }
  9772. var strWave = 'wave'+selectFWWave.value;
  9773. if(isNullOrUndefined(storageValue[strWave].weapon))
  9774. storageValue[strWave].weapon = 'Sandtail Sentinel';
  9775. if(isNullOrUndefined(storageValue[strWave].base))
  9776. storageValue[strWave].base = 'Physical Brace Base';
  9777. if(selectFWWave.value == 4){
  9778. selectFW4TrapSetupWeapon.value = storageValue[strWave].warden[selectFW4WardenStatus.value].weapon;
  9779. selectFW4TrapSetupBase.value = storageValue[strWave].warden[selectFW4WardenStatus.value].base;
  9780. selectFW4TrapSetupTrinket.value = storageValue[strWave].warden[selectFW4WardenStatus.value].trinket;
  9781. selectFW4TrapSetupBait.value = storageValue[strWave].warden[selectFW4WardenStatus.value].bait;
  9782. }
  9783. else{
  9784. selectFWTrapSetupWeapon.value = storageValue[strWave].weapon;
  9785. selectFWTrapSetupBase.value = storageValue[strWave].base;
  9786. }
  9787. selectFWFocusType.value = storageValue[strWave].focusType;
  9788. selectFWPriorities.value = storageValue[strWave].priorities;
  9789. selectFWCheese.value = storageValue[strWave].cheese[selectFWStreak.selectedIndex];
  9790. selectFWCharmType.value = storageValue[strWave].charmType[selectFWStreak.selectedIndex];
  9791. selectFWSpecial.value = storageValue[strWave].special[selectFWStreak.selectedIndex];
  9792. selectFWLastTypeConfig.value = storageValue[strWave].lastSoldierConfig;
  9793. selectFWLastTypeConfigIncludeArtillery.value = (storageValue[strWave].includeArtillery) ? 'true' : 'false';
  9794. selectFWSupportConfig.value = (storageValue[strWave].disarmAfterSupportRetreat) ? 'true' : 'false';
  9795. }
  9796. for(var i=0;i<selectFWSpecial.options.length;i++){
  9797. if(selectFWSpecial.options[i].value == 'GARGANTUA_GGC'){
  9798. if(selectFWStreak.selectedIndex >= 7)
  9799. selectFWSpecial.options[i].removeAttribute('disabled');
  9800. else
  9801. selectFWSpecial.options[i].setAttribute('disabled','disabled');
  9802. break;
  9803. }
  9804. }
  9805. var nWave = parseInt(selectFWWave.value);
  9806. var option = selectFWFocusType.children;
  9807. for(var i=0;i<option.length;i++){
  9808. if(option[i].innerText.indexOf('Special') > -1)
  9809. option[i].style = (nWave==1) ? 'display:none' : '';
  9810. }
  9811. if(selectFWWave.value == 4){
  9812. document.getElementById('trFWStreak').style.display = 'none';
  9813. document.getElementById('trFWFocusType').style.display = 'none';
  9814. document.getElementById('trFWLastType').style.display = 'none';
  9815. document.getElementById('trFWSupportConfig').style.display = 'none';
  9816. document.getElementById('trFWTrapSetup').style.display = 'none';
  9817. document.getElementById('trFW4TrapSetup').style.display = 'table-row';
  9818. }
  9819. else{
  9820. document.getElementById('trFWStreak').style.display = 'table-row';
  9821. document.getElementById('trFWFocusType').style.display = 'table-row';
  9822. document.getElementById('trFWLastType').style.display = 'table-row';
  9823. document.getElementById('trFWSupportConfig').style.display = 'table-row';
  9824. document.getElementById('trFWTrapSetup').style.display = 'table-row';
  9825. document.getElementById('trFW4TrapSetup').style.display = 'none';
  9826. if(selectFWWave.value == 3)
  9827. selectFWLastTypeConfigIncludeArtillery.disabled = '';
  9828. else
  9829. selectFWLastTypeConfigIncludeArtillery.disabled = 'disabled';
  9830. }
  9831. }
  9832.  
  9833. function saveFW(){
  9834. var selectFWWave = document.getElementById('selectFWWave');
  9835. var selectFWTrapSetupWeapon = document.getElementById('selectFWTrapSetupWeapon');
  9836. var selectFWTrapSetupBase = document.getElementById('selectFWTrapSetupBase');
  9837. var nWave = selectFWWave.value;
  9838. var selectFWStreak = document.getElementById('selectFWStreak');
  9839. var nStreak = parseInt(selectFWStreak.value);
  9840. var nStreakLength = selectFWStreak.children.length;
  9841. var selectFWFocusType = document.getElementById('selectFWFocusType');
  9842. var selectFWPriorities = document.getElementById('selectFWPriorities');
  9843. var selectFWCheese = document.getElementById('selectFWCheese');
  9844. var selectFWCharmType = document.getElementById('selectFWCharmType');
  9845. var selectFWSpecial = document.getElementById('selectFWSpecial');
  9846. var selectFWLastTypeConfig = document.getElementById('selectFWLastTypeConfig');
  9847. var selectFWLastTypeConfigIncludeArtillery = document.getElementById('selectFWLastTypeConfigIncludeArtillery');
  9848. var selectFWSupportConfig = document.getElementById('selectFWSupportConfig');
  9849. var selectFW4WardenStatus = document.getElementById('selectFW4WardenStatus');
  9850. var selectFW4TrapSetupWeapon = document.getElementById('selectFW4TrapSetupWeapon');
  9851. var selectFW4TrapSetupBase = document.getElementById('selectFW4TrapSetupBase');
  9852. var selectFW4TrapSetupTrinket = document.getElementById('selectFW4TrapSetupTrinket');
  9853. var selectFW4TrapSetupBait = document.getElementById('selectFW4TrapSetupBait');
  9854. var storageValue = window.sessionStorage.getItem('FW');
  9855. if(isNullOrUndefined(storageValue)){
  9856. var obj = {
  9857. weapon : new Array(4),
  9858. base : new Array(4),
  9859. focusType : 'NORMAL',
  9860. priorities : 'HIGHEST',
  9861. cheese : new Array(nStreakLength),
  9862. charmType : new Array(nStreakLength),
  9863. special : new Array(nStreakLength),
  9864. lastSoldierConfig : 'CONFIG_GOUDA',
  9865. includeArtillery : true,
  9866. disarmAfterSupportRetreat : false,
  9867. warden : {
  9868. before : {
  9869. weapon : '',
  9870. base : '',
  9871. trinket : '',
  9872. bait : ''
  9873. },
  9874. after : {
  9875. weapon : '',
  9876. base : '',
  9877. trinket : '',
  9878. bait : ''
  9879. }
  9880. }
  9881. };
  9882. var objAll = {
  9883. wave1 : JSON.parse(JSON.stringify(obj)),
  9884. wave2 : JSON.parse(JSON.stringify(obj)),
  9885. wave3 : JSON.parse(JSON.stringify(obj)),
  9886. wave4 : JSON.parse(JSON.stringify(obj)),
  9887. };
  9888. storageValue = JSON.stringify(objAll);
  9889. }
  9890. storageValue = JSON.parse(storageValue);
  9891. var strWave = 'wave'+selectFWWave.value;
  9892. if(isNullOrUndefined(storageValue[strWave].weapon))
  9893. storageValue[strWave].weapon = 'Sandtail Sentinel';
  9894. if(isNullOrUndefined(storageValue[strWave].base))
  9895. storageValue[strWave].base = 'Physical Brace Base';
  9896. if(nWave == 4){
  9897. storageValue[strWave].warden[selectFW4WardenStatus.value].weapon = selectFW4TrapSetupWeapon.value;
  9898. storageValue[strWave].warden[selectFW4WardenStatus.value].base = selectFW4TrapSetupBase.value;
  9899. storageValue[strWave].warden[selectFW4WardenStatus.value].trinket = selectFW4TrapSetupTrinket.value;
  9900. storageValue[strWave].warden[selectFW4WardenStatus.value].bait = selectFW4TrapSetupBait.value;
  9901. }
  9902. else{
  9903. storageValue[strWave].weapon = selectFWTrapSetupWeapon.value;
  9904. storageValue[strWave].base = selectFWTrapSetupBase.value;
  9905. }
  9906. storageValue[strWave].focusType = selectFWFocusType.value;
  9907. storageValue[strWave].priorities = selectFWPriorities.value;
  9908. storageValue[strWave].cheese[nStreak] = selectFWCheese.value;
  9909. storageValue[strWave].charmType[nStreak] = selectFWCharmType.value;
  9910. storageValue[strWave].special[nStreak] = selectFWSpecial.value;
  9911. storageValue[strWave].lastSoldierConfig = selectFWLastTypeConfig.value;
  9912. storageValue[strWave].includeArtillery = (selectFWLastTypeConfigIncludeArtillery.value == 'true');
  9913. storageValue[strWave].disarmAfterSupportRetreat = (selectFWSupportConfig.value == 'true');
  9914. window.sessionStorage.setItem('FW', JSON.stringify(storageValue));
  9915. }
  9916.  
  9917. function onSelectBRHuntMistTierChanged(){
  9918. var hunt = document.getElementById('selectBRHuntMistTier').value;
  9919. var storageValue = window.sessionStorage.getItem('BRCustom');
  9920. if(isNullOrUndefined(storageValue)){
  9921. var objBR = {
  9922. hunt : '',
  9923. toggle : 1,
  9924. name : ['Red', 'Green', 'Yellow', 'None'],
  9925. weapon : new Array(4),
  9926. base : new Array(4),
  9927. trinket : new Array(4),
  9928. bait : new Array(4)
  9929. };
  9930. storageValue = JSON.stringify(objBR);
  9931. }
  9932. storageValue = JSON.parse(storageValue);
  9933. storageValue.hunt = hunt;
  9934. window.sessionStorage.setItem('BRCustom', JSON.stringify(storageValue));
  9935. initControlsBR();
  9936. }
  9937.  
  9938. function onInputToggleCanisterChanged(input){
  9939. input.value = limitMinMax(input.value, input.min, input.max);
  9940. saveBR();
  9941. }
  9942.  
  9943. function initControlsBR(){
  9944. var hunt = document.getElementById('selectBRHuntMistTier');
  9945. var toggle = document.getElementById('inputToggleCanister');
  9946. var weapon = document.getElementById('selectBRTrapWeapon');
  9947. var base = document.getElementById('selectBRTrapBase');
  9948. var trinket = document.getElementById('selectBRTrapTrinket');
  9949. var bait = document.getElementById('selectBRTrapBait');
  9950. var storageValue = window.sessionStorage.getItem('BRCustom');
  9951. if(isNullOrUndefined(storageValue)){
  9952. toggle.value = 1;
  9953. hunt.selectedIndex = 0;
  9954. weapon.selectedIndex = -1;
  9955. base.selectedIndex = -1;
  9956. trinket.selectedIndex = -1;
  9957. bait.selectedIndex = -1;
  9958. }
  9959. else{
  9960. storageValue = JSON.parse(storageValue);
  9961. hunt.value = storageValue.hunt;
  9962. toggle.value = storageValue.toggle;
  9963. var nIndex = storageValue.name.indexOf(hunt.value);
  9964. weapon.value = storageValue.weapon[nIndex];
  9965. base.value = storageValue.base[nIndex];
  9966. trinket.value = storageValue.trinket[nIndex];
  9967. bait.value = storageValue.bait[nIndex];
  9968. }
  9969. document.getElementById('trBRToggle').style.display = (hunt.value == 'Red')? 'table-row' : 'none';
  9970. }
  9971.  
  9972. function saveBR(){
  9973. var hunt = document.getElementById('selectBRHuntMistTier').value;
  9974. var nToggle = parseInt(document.getElementById('inputToggleCanister').value);
  9975. var weapon = document.getElementById('selectBRTrapWeapon').value;
  9976. var base = document.getElementById('selectBRTrapBase').value;
  9977. var trinket = document.getElementById('selectBRTrapTrinket').value;
  9978. var bait = document.getElementById('selectBRTrapBait').value;
  9979. var storageValue = window.sessionStorage.getItem('BRCustom');
  9980. if(isNullOrUndefined(storageValue)){
  9981. var objBR = {
  9982. hunt : '',
  9983. toggle : 1,
  9984. name : ['Red', 'Green', 'Yellow', 'None'],
  9985. weapon : new Array(4),
  9986. base : new Array(4),
  9987. trinket : new Array(4),
  9988. bait : new Array(4)
  9989. };
  9990. storageValue = JSON.stringify(objBR);
  9991. }
  9992. storageValue = JSON.parse(storageValue);
  9993. var nIndex = storageValue.name.indexOf(hunt);
  9994. if(nIndex < 0)
  9995. nIndex = 0;
  9996. storageValue.hunt = hunt;
  9997. storageValue.toggle = nToggle;
  9998. storageValue.weapon[nIndex] = weapon;
  9999. storageValue.base[nIndex] = base;
  10000. storageValue.trinket[nIndex] = trinket;
  10001. storageValue.bait[nIndex] = bait;
  10002. window.sessionStorage.setItem('BRCustom', JSON.stringify(storageValue));
  10003. }
  10004.  
  10005. function saveSG(){
  10006. var selectSGSeason = document.getElementById('selectSGSeason');
  10007. var selectSGTrapWeapon = document.getElementById('selectSGTrapWeapon');
  10008. var selectSGTrapBase = document.getElementById('selectSGTrapBase');
  10009. var selectSGTrapTrinket = document.getElementById('selectSGTrapTrinket');
  10010. var selectSGTrapBait = document.getElementById('selectSGTrapBait');
  10011. var selectSGDisarmBait = document.getElementById('selectSGDisarmBait');
  10012. var storageValue = window.sessionStorage.getItem('SGarden');
  10013. if(isNullOrUndefined(storageValue)){
  10014. var objSG = {
  10015. weapon : new Array(4).fill(''),
  10016. base : new Array(4).fill(''),
  10017. trinket : new Array(4).fill(''),
  10018. bait : new Array(4).fill(''),
  10019. disarmBaitAfterCharged : false
  10020. };
  10021. storageValue = JSON.stringify(objSG);
  10022. }
  10023. storageValue = JSON.parse(storageValue);
  10024. var nIndex = (selectSGSeason.selectedIndex < 0) ? 0 : selectSGSeason.selectedIndex;
  10025. storageValue.weapon[nIndex] = selectSGTrapWeapon.value;
  10026. storageValue.base[nIndex] = selectSGTrapBase.value;
  10027. storageValue.trinket[nIndex] = selectSGTrapTrinket.value;
  10028. storageValue.bait[nIndex] = selectSGTrapBait.value;
  10029. storageValue.disarmBaitAfterCharged = (selectSGDisarmBait.value == 'true');
  10030. window.sessionStorage.setItem('SGarden', JSON.stringify(storageValue));
  10031. }
  10032.  
  10033. function initControlsSG(bAutoChangeSeason){
  10034. if(isNullOrUndefined(bAutoChangeSeason))
  10035. bAutoChangeSeason = false;
  10036. var selectSGSeason = document.getElementById('selectSGSeason');
  10037. var selectSGTrapWeapon = document.getElementById('selectSGTrapWeapon');
  10038. var selectSGTrapBase = document.getElementById('selectSGTrapBase');
  10039. var selectSGTrapTrinket = document.getElementById('selectSGTrapTrinket');
  10040. var selectSGTrapBait = document.getElementById('selectSGTrapBait');
  10041. var selectSGDisarmBait = document.getElementById('selectSGDisarmBait');
  10042. var storageValue = window.sessionStorage.getItem('SGarden');
  10043. if(isNullOrUndefined(storageValue)){
  10044. selectSGTrapWeapon.selectedIndex = -1;
  10045. selectSGTrapBase.selectedIndex = -1;
  10046. selectSGTrapTrinket.selectedIndex = -1;
  10047. selectSGTrapBait.selectedIndex = -1;
  10048. selectSGDisarmBait.selectedIndex = -1;
  10049. }
  10050. else{
  10051. storageValue = JSON.parse(storageValue);
  10052. if(bAutoChangeSeason && !isNullOrUndefined(user) && user.location.indexOf('Seasonal Garden') > -1){
  10053. var arrSeason = ['Spring', 'Summer', 'Fall', 'Winter'];
  10054. var nTimeStamp = Date.parse(new Date())/1000;
  10055. var nFirstSeasonTimeStamp = 1283328000;
  10056. var nSeasonLength = 288000; // 80hr
  10057. var nSeason = Math.floor((nTimeStamp - nFirstSeasonTimeStamp)/nSeasonLength) % arrSeason.length;
  10058. selectSGSeason.value = arrSeason[nSeason].toUpperCase();
  10059. }
  10060. var nIndex = (selectSGSeason.selectedIndex < 0) ? 0 : selectSGSeason.selectedIndex;
  10061. selectSGTrapWeapon.value = storageValue.weapon[nIndex];
  10062. selectSGTrapBase.value = storageValue.base[nIndex];
  10063. selectSGTrapTrinket.value = storageValue.trinket[nIndex];
  10064. selectSGTrapBait.value = storageValue.bait[nIndex];
  10065. selectSGDisarmBait.value = (storageValue.disarmBaitAfterCharged) ? 'true' : 'false';
  10066. }
  10067. }
  10068.  
  10069. function initControlsZT(bAutoChangeMouseOrder){
  10070. if(isNullOrUndefined(bAutoChangeMouseOrder))
  10071. bAutoChangeMouseOrder = false;
  10072. var selectZTFocus = document.getElementById('selectZTFocus');
  10073. var arrSelectZTMouseOrder = [document.getElementById('selectZTMouseOrder1st'),document.getElementById('selectZTMouseOrder2nd')];
  10074. var arrSelectZTWeapon = [document.getElementById('selectZTWeapon1st'),document.getElementById('selectZTWeapon2nd')];
  10075. var arrSelectZTBase = [document.getElementById('selectZTBase1st'),document.getElementById('selectZTBase2nd')];
  10076. var arrSelectZTTrinket = [document.getElementById('selectZTTrinket1st'),document.getElementById('selectZTTrinket2nd')];
  10077. var arrSelectZTBait = [document.getElementById('selectZTBait1st'),document.getElementById('selectZTBait2nd')];
  10078. var storageValue = window.sessionStorage.getItem('ZTower');
  10079. var i;
  10080. if(isNullOrUndefined(storageValue)){
  10081. for(i=0;i<2;i++){
  10082. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10083. arrSelectZTWeapon[i].selectedIndex = -1;
  10084. arrSelectZTBase[i].selectedIndex = -1;
  10085. arrSelectZTTrinket[i].selectedIndex = -1;
  10086. arrSelectZTBait[i].selectedIndex = -1;
  10087. }
  10088. }
  10089. else{
  10090. storageValue = JSON.parse(storageValue);
  10091. selectZTFocus.value = storageValue.focus.toUpperCase();
  10092. if(bAutoChangeMouseOrder && !isNullOrUndefined(user) && user.location.indexOf('Zugzwang\'s Tower') > -1){
  10093. var nProgressMystic = parseInt(user.viewing_atts.zzt_mage_progress);
  10094. var nProgressTechnic = parseInt(user.viewing_atts.zzt_tech_progress);
  10095. if(Number.isNaN(nProgressMystic) || Number.isNaN(nProgressTechnic)){
  10096. for(i=0;i<2;i++){
  10097. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10098. }
  10099. }
  10100. else{
  10101. var arrProgress = [];
  10102. if(selectZTFocus.value.indexOf('MYSTIC') === 0)
  10103. arrProgress = [nProgressMystic,nProgressTechnic];
  10104. else
  10105. arrProgress = [nProgressTechnic,nProgressMystic];
  10106. for(i=0;i<2;i++){
  10107. if(arrProgress[i] <= 7)
  10108. arrSelectZTMouseOrder[i].value = 'PAWN';
  10109. else if(arrProgress[i] <= 9)
  10110. arrSelectZTMouseOrder[i].value = 'KNIGHT';
  10111. else if(arrProgress[i] <= 11)
  10112. arrSelectZTMouseOrder[i].value = 'BISHOP';
  10113. else if(arrProgress[i] <= 13)
  10114. arrSelectZTMouseOrder[i].value = 'ROOK';
  10115. else if(arrProgress[i] <= 14)
  10116. arrSelectZTMouseOrder[i].value = 'QUEEN';
  10117. else if(arrProgress[i] <= 15)
  10118. arrSelectZTMouseOrder[i].value = 'KING';
  10119. else if(arrProgress[i] <= 16)
  10120. arrSelectZTMouseOrder[i].value = 'CHESSMASTER';
  10121. }
  10122. }
  10123. }
  10124. for(i=0;i<2;i++){
  10125. if(arrSelectZTMouseOrder[i].selectedIndex < 0)
  10126. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10127. }
  10128. var nIndex = -1;
  10129. for(i=0;i<2;i++){
  10130. nIndex = storageValue.order.indexOf(arrSelectZTMouseOrder[i].value);
  10131. if(nIndex < 0)
  10132. nIndex = 0;
  10133. nIndex += i*7;
  10134. arrSelectZTWeapon[i].value = storageValue.weapon[nIndex];
  10135. arrSelectZTBase[i].value = storageValue.base[nIndex];
  10136. arrSelectZTTrinket[i].value = storageValue.trinket[nIndex];
  10137. arrSelectZTBait[i].value = storageValue.bait[nIndex];
  10138. }
  10139. }
  10140. }
  10141.  
  10142. function saveZT(){
  10143. var selectZTFocus = document.getElementById('selectZTFocus');
  10144. var arrSelectZTMouseOrder = [document.getElementById('selectZTMouseOrder1st'),document.getElementById('selectZTMouseOrder2nd')];
  10145. var arrSelectZTWeapon = [document.getElementById('selectZTWeapon1st'),document.getElementById('selectZTWeapon2nd')];
  10146. var arrSelectZTBase = [document.getElementById('selectZTBase1st'),document.getElementById('selectZTBase2nd')];
  10147. var arrSelectZTTrinket = [document.getElementById('selectZTTrinket1st'),document.getElementById('selectZTTrinket2nd')];
  10148. var arrSelectZTBait = [document.getElementById('selectZTBait1st'),document.getElementById('selectZTBait2nd')];
  10149. var storageValue = window.sessionStorage.getItem('ZTower');
  10150. if(isNullOrUndefined(storageValue)){
  10151. var objZT = {
  10152. focus : 'MYSTIC',
  10153. order : ['PAWN', 'KNIGHT', 'BISHOP', 'ROOK', 'QUEEN', 'KING', 'CHESSMASTER'],
  10154. weapon : new Array(14).fill(''),
  10155. base : new Array(14).fill(''),
  10156. trinket : new Array(14).fill('None'),
  10157. bait : new Array(14).fill('Gouda'),
  10158. };
  10159. storageValue = JSON.stringify(objZT);
  10160. }
  10161. storageValue = JSON.parse(storageValue);
  10162. var nIndex = -1;
  10163. for(var i=0;i<2;i++){
  10164. nIndex = storageValue.order.indexOf(arrSelectZTMouseOrder[i].value);
  10165. if(nIndex < 0)
  10166. nIndex = 0;
  10167. nIndex += i*7;
  10168. storageValue.focus = selectZTFocus.value;
  10169. storageValue.weapon[nIndex] = arrSelectZTWeapon[i].value;
  10170. storageValue.base[nIndex] = arrSelectZTBase[i].value;
  10171. storageValue.trinket[nIndex] = arrSelectZTTrinket[i].value;
  10172. storageValue.bait[nIndex] = arrSelectZTBait[i].value;
  10173. }
  10174. window.sessionStorage.setItem('ZTower', JSON.stringify(storageValue));
  10175. }
  10176.  
  10177. function saveZokor(){
  10178. var selectZokorBossStatus = document.getElementById('selectZokorBossStatus');
  10179. var selectZokorBait = document.getElementById('selectZokorBait');
  10180. var selectZokorTrinket = document.getElementById('selectZokorTrinket');
  10181. var storageValue = window.sessionStorage.getItem('Zokor');
  10182. if(isNullOrUndefined(storageValue)){
  10183. var objZokor = {
  10184. bossStatus : ['INCOMING', 'ACTIVE', 'DEFEATED'],
  10185. bait : new Array(3).fill('Gouda'),
  10186. trinket : new Array(3).fill('None')
  10187. };
  10188. storageValue = JSON.stringify(objZokor);
  10189. }
  10190. storageValue = JSON.parse(storageValue);
  10191. var nIndex = storageValue.bossStatus.indexOf(selectZokorBossStatus.value);
  10192. if(nIndex < 0)
  10193. nIndex = 0;
  10194. storageValue.bait[nIndex] = selectZokorBait.value;
  10195. storageValue.trinket[nIndex] = selectZokorTrinket.value;
  10196. window.sessionStorage.setItem('Zokor', JSON.stringify(storageValue));
  10197. }
  10198.  
  10199. function initControlsZokor(){
  10200. var selectZokorBossStatus = document.getElementById('selectZokorBossStatus');
  10201. var selectZokorBait = document.getElementById('selectZokorBait');
  10202. var selectZokorTrinket = document.getElementById('selectZokorTrinket');
  10203. var storageValue = window.sessionStorage.getItem('Zokor');
  10204. if(isNullOrUndefined(storageValue)){
  10205. selectZokorBait.selectedIndex = -1;
  10206. selectZokorTrinket.selectedIndex = -1;
  10207. }
  10208. else{
  10209. storageValue = JSON.parse(storageValue);
  10210. var nIndex = storageValue.bossStatus.indexOf(selectZokorBossStatus.value);
  10211. if(nIndex < 0)
  10212. nIndex = 0;
  10213. selectZokorBait.value = storageValue.bait[nIndex];
  10214. selectZokorTrinket.value = storageValue.trinket[nIndex];
  10215. }
  10216. }
  10217.  
  10218. function onSelectFRTrapBait(){
  10219. saveFR();
  10220. initControlsFR();
  10221. }
  10222.  
  10223. function saveFR(){
  10224. var selectEnterAtBattery = document.getElementById('selectEnterAtBattery');
  10225. var selectRetreatAtBattery = document.getElementById('selectRetreatAtBattery');
  10226. var nIndex = document.getElementById('selectTrapSetupAtBattery').selectedIndex;
  10227. var weapon = document.getElementById('selectFRTrapWeapon').value;
  10228. var base = document.getElementById('selectFRTrapBase').value;
  10229. var trinket = document.getElementById('selectFRTrapTrinket').value;
  10230. var bait = document.getElementById('selectFRTrapBait').value;
  10231. var selectFRTrapBaitMasterOrder = document.getElementById('selectFRTrapBaitMasterOrder');
  10232. var storageValue = window.sessionStorage.getItem('FRift');
  10233. if(isNullOrUndefined(storageValue)){
  10234. var objFR = {
  10235. enter : 0,
  10236. retreat : 0,
  10237. weapon : new Array(11).fill(''),
  10238. base : new Array(11).fill(''),
  10239. trinket : new Array(11).fill(''),
  10240. bait : new Array(11).fill(''),
  10241. masterOrder : new Array(11).fill('Glutter=>Combat=>Susheese')
  10242. };
  10243. storageValue = JSON.stringify(objFR);
  10244. }
  10245. storageValue = JSON.parse(storageValue);
  10246. storageValue.enter = parseInt(selectEnterAtBattery.value);
  10247. storageValue.retreat = parseInt(selectRetreatAtBattery.value);
  10248. storageValue.weapon[nIndex] = weapon;
  10249. storageValue.base[nIndex] = base;
  10250. storageValue.trinket[nIndex] = trinket;
  10251. storageValue.bait[nIndex] = bait;
  10252. storageValue.masterOrder[nIndex] = selectFRTrapBaitMasterOrder.value;
  10253. window.sessionStorage.setItem('FRift', JSON.stringify(storageValue));
  10254. }
  10255.  
  10256. function initControlsFR(bAutoChangeBatteryLevel){
  10257. if(isNullOrUndefined(bAutoChangeBatteryLevel))
  10258. bAutoChangeBatteryLevel = false;
  10259. var selectEnterAtBattery = document.getElementById('selectEnterAtBattery');
  10260. var selectRetreatAtBattery = document.getElementById('selectRetreatAtBattery');
  10261. var selectTrapSetupAtBattery = document.getElementById('selectTrapSetupAtBattery');
  10262. var selectFRTrapWeapon = document.getElementById('selectFRTrapWeapon');
  10263. var selectFRTrapBase = document.getElementById('selectFRTrapBase');
  10264. var selectFRTrapTrinket = document.getElementById('selectFRTrapTrinket');
  10265. var selectFRTrapBait = document.getElementById('selectFRTrapBait');
  10266. var selectFRTrapBaitMasterOrder = document.getElementById('selectFRTrapBaitMasterOrder');
  10267. var storageValue = window.sessionStorage.getItem('FRift');
  10268. if(isNullOrUndefined(storageValue)){
  10269. selectEnterAtBattery.selectedIndex = -1;
  10270. selectRetreatAtBattery.selectedIndex = -1;
  10271. selectFRTrapWeapon.selectedIndex = -1;
  10272. selectFRTrapBase.selectedIndex = -1;
  10273. selectFRTrapTrinket.selectedIndex = -1;
  10274. selectFRTrapBait.selectedIndex = -1;
  10275. selectFRTrapBaitMasterOrder.selectedIndex = 0;
  10276. selectTrapSetupAtBattery.selectedIndex = 0;
  10277. }
  10278. else{
  10279. storageValue = JSON.parse(storageValue);
  10280. var nIndex = 0;
  10281. if(bAutoChangeBatteryLevel && !isNullOrUndefined(user) && user.location.indexOf('Furoma Rift') > -1 && (user.quests.QuestRiftFuroma.view_state == 'pagoda' || user.quests.QuestRiftFuroma.view_state == 'pagoda knows_all')){
  10282. var classCharge = document.getElementsByClassName('riftFuromaHUD-droid-charge');
  10283. if(classCharge.length > 0){
  10284. var nRemainingEnergy = parseInt(classCharge[0].innerText.replace(/,/g, ''));
  10285. if(Number.isInteger(nRemainingEnergy)){
  10286. var arrCumulative = [20,65,140,260,460,770,1220,1835,2625,3600];
  10287. for(var i=arrCumulative.length-1;i>=0;i--){
  10288. if(nRemainingEnergy <= arrCumulative[i])
  10289. nIndex = i+1;
  10290. else
  10291. break;
  10292. }
  10293. selectTrapSetupAtBattery.selectedIndex = nIndex;
  10294. }
  10295. }
  10296. }
  10297. else{
  10298. nIndex = selectTrapSetupAtBattery.selectedIndex;
  10299. }
  10300. selectEnterAtBattery.value = (Number.isInteger(storageValue.enter)) ? storageValue.enter : 'None';
  10301. selectRetreatAtBattery.value = storageValue.retreat;
  10302. selectFRTrapWeapon.value = storageValue.weapon[nIndex];
  10303. selectFRTrapBase.value = storageValue.base[nIndex];
  10304. selectFRTrapTrinket.value = storageValue.trinket[nIndex];
  10305. selectFRTrapBait.value = storageValue.bait[nIndex];
  10306. selectFRTrapBaitMasterOrder.value = storageValue.masterOrder[nIndex];
  10307. }
  10308. selectFRTrapBaitMasterOrder.style.display = (selectFRTrapBait.value == 'ORDER_MASTER') ? '' : 'none';
  10309. }
  10310.  
  10311. function saveIceberg(){
  10312. var selectIcebergPhase = document.getElementById('selectIcebergPhase');
  10313. var selectIcebergBase = document.getElementById('selectIcebergBase');
  10314. var selectIcebergBait = document.getElementById('selectIcebergBait');
  10315. var selectIcebergTrinket = document.getElementById('selectIcebergTrinket');
  10316. var storageValue = window.sessionStorage.getItem('Iceberg');
  10317. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  10318. if(isNullOrUndefined(storageValue)){
  10319. var objDefaultIceberg = {
  10320. base : new Array(9).fill(''),
  10321. trinket : new Array(9).fill('None'),
  10322. bait : new Array(9).fill('Gouda')
  10323. };
  10324. storageValue = JSON.stringify(objDefaultIceberg);
  10325. }
  10326. storageValue = JSON.parse(storageValue);
  10327. var nIndex = arrOrder.indexOf(selectIcebergPhase.value);
  10328. if(nIndex < 0)
  10329. nIndex = 0;
  10330. storageValue.base[nIndex] = selectIcebergBase.value;
  10331. storageValue.bait[nIndex] = selectIcebergBait.value;
  10332. storageValue.trinket[nIndex] = selectIcebergTrinket.value;
  10333. window.sessionStorage.setItem('Iceberg', JSON.stringify(storageValue));
  10334. }
  10335.  
  10336. function initControlsIceberg(bAutoChangePhase){
  10337. if(isNullOrUndefined(bAutoChangePhase))
  10338. bAutoChangePhase = false;
  10339. var selectIcebergPhase = document.getElementById('selectIcebergPhase');
  10340. var selectIcebergBase = document.getElementById('selectIcebergBase');
  10341. var selectIcebergBait = document.getElementById('selectIcebergBait');
  10342. var selectIcebergTrinket = document.getElementById('selectIcebergTrinket');
  10343. var storageValue = window.sessionStorage.getItem('Iceberg');
  10344. if(isNullOrUndefined(storageValue)){
  10345. selectIcebergBase.selectedIndex = -1;
  10346. selectIcebergBait.selectedIndex = -1;
  10347. selectIcebergTrinket.selectedIndex = -1;
  10348. }
  10349. else{
  10350. storageValue = JSON.parse(storageValue);
  10351. var nIndex = -1;
  10352. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  10353. if(bAutoChangePhase && !isNullOrUndefined(user)){
  10354. if(user.location.indexOf('Iceberg') > -1){
  10355. var classCurrentPhase = document.getElementsByClassName('currentPhase');
  10356. var phase = (classCurrentPhase.length > 0) ? classCurrentPhase[0].textContent : user.quests.QuestIceberg.current_phase;
  10357. var classProgress = document.getElementsByClassName('user_progress');
  10358. var nProgress = (classProgress.length > 0) ? parseInt(classProgress[0].textContent.replace(',', '')) : parseInt(user.quests.QuestIceberg.user_progress);
  10359. if (nProgress == 300 || nProgress == 600 || nProgress == 1600 || nProgress == 1800)
  10360. nIndex = 0;
  10361. else{
  10362. phase = phase.toUpperCase();
  10363. for(var i=1;i<arrOrder.length;i++){
  10364. if(phase.indexOf(arrOrder[i]) > -1){
  10365. selectIcebergPhase.value = arrOrder[i];
  10366. break;
  10367. }
  10368. }
  10369. }
  10370. }
  10371. else if(user.location.indexOf('Slushy Shoreline') > -1)
  10372. selectIcebergPhase.value = 'SLUSHY';
  10373. }
  10374. nIndex = arrOrder.indexOf(selectIcebergPhase.value);
  10375. selectIcebergBase.value = storageValue.base[nIndex];
  10376. selectIcebergTrinket.value = storageValue.trinket[nIndex];
  10377. selectIcebergBait.value = storageValue.bait[nIndex];
  10378. }
  10379. }
  10380.  
  10381. function saveFGAR(){
  10382. var selectFGARSublocation = document.getElementById('selectFGARSublocation');
  10383. var selectFGARWeapon = document.getElementById('selectFGARWeapon');
  10384. var selectFGARBase = document.getElementById('selectFGARBase');
  10385. var selectFGARTrinket = document.getElementById('selectFGARTrinket');
  10386. var selectFGARBait = document.getElementById('selectFGARBait');
  10387. var storageValue = window.sessionStorage.getItem('FG_AR');
  10388. if(isNullOrUndefined(storageValue))
  10389. storageValue = JSON.stringify(objDefaultFGAR);
  10390. storageValue = JSON.parse(storageValue);
  10391. var nIndex = storageValue.order.indexOf(selectFGARSublocation.value);
  10392. storageValue.weapon[nIndex] = selectFGARWeapon.value;
  10393. storageValue.base[nIndex] = selectFGARBase.value;
  10394. storageValue.trinket[nIndex] = selectFGARTrinket.value;
  10395. storageValue.bait[nIndex] = selectFGARBait.value;
  10396. window.sessionStorage.setItem('FG_AR', JSON.stringify(storageValue));
  10397. }
  10398.  
  10399. function initControlsFGAR(bAutoChangeSublocation){
  10400. if(isNullOrUndefined(bAutoChangeSublocation))
  10401. bAutoChangeSublocation = false;
  10402. var selectFGARSublocation = document.getElementById('selectFGARSublocation');
  10403. var selectFGARWeapon = document.getElementById('selectFGARWeapon');
  10404. var selectFGARBase = document.getElementById('selectFGARBase');
  10405. var selectFGARTrinket = document.getElementById('selectFGARTrinket');
  10406. var selectFGARBait = document.getElementById('selectFGARBait');
  10407. var storageValue = window.sessionStorage.getItem('FG_AR');
  10408. if(isNullOrUndefined(storageValue))
  10409. storageValue = JSON.stringify(objDefaultFGAR);
  10410. storageValue = JSON.parse(storageValue);
  10411. var nIndex = -1;
  10412. if(bAutoChangeSublocation && !isNullOrUndefined(user))
  10413. selectFGARSublocation.value = (user.location.indexOf('Acolyte Realm') > -1) ? 'AR' : 'FG';
  10414. nIndex = storageValue.order.indexOf(selectFGARSublocation.value);
  10415. selectFGARWeapon.value = storageValue.weapon[nIndex];
  10416. selectFGARBase.value = storageValue.base[nIndex];
  10417. selectFGARTrinket.value = storageValue.trinket[nIndex];
  10418. selectFGARBait.value = storageValue.bait[nIndex];
  10419. }
  10420.  
  10421. function saveBCJOD(){
  10422. var selectBCJODSublocation = document.getElementById('selectBCJODSublocation');
  10423. var selectBCJODWeapon = document.getElementById('selectBCJODWeapon');
  10424. var selectBCJODBase = document.getElementById('selectBCJODBase');
  10425. var selectBCJODTrinket = document.getElementById('selectBCJODTrinket');
  10426. var selectBCJODBait = document.getElementById('selectBCJODBait');
  10427. var storageValue = window.sessionStorage.getItem('BC_JOD');
  10428. if(isNullOrUndefined(storageValue))
  10429. storageValue = JSON.stringify(objDefaultBCJOD);
  10430. storageValue = JSON.parse(storageValue);
  10431. var nIndex = storageValue.order.indexOf(selectBCJODSublocation.value);
  10432. storageValue.weapon[nIndex] = selectBCJODWeapon.value;
  10433. storageValue.base[nIndex] = selectBCJODBase.value;
  10434. storageValue.trinket[nIndex] = selectBCJODTrinket.value;
  10435. storageValue.bait[nIndex] = selectBCJODBait.value;
  10436. window.sessionStorage.setItem('BC_JOD', JSON.stringify(storageValue));
  10437. }
  10438.  
  10439. function initControlsBCJOD(bAutoChangeSublocation){
  10440. if(isNullOrUndefined(bAutoChangeSublocation))
  10441. bAutoChangeSublocation = false;
  10442. var selectBCJODSublocation = document.getElementById('selectBCJODSublocation');
  10443. var selectBCJODWeapon = document.getElementById('selectBCJODWeapon');
  10444. var selectBCJODBase = document.getElementById('selectBCJODBase');
  10445. var selectBCJODTrinket = document.getElementById('selectBCJODTrinket');
  10446. var selectBCJODBait = document.getElementById('selectBCJODBait');
  10447. var storageValue = window.sessionStorage.getItem('BC_JOD');
  10448. if(isNullOrUndefined(storageValue))
  10449. storageValue = JSON.stringify(objDefaultBCJOD);
  10450. storageValue = JSON.parse(storageValue);
  10451. var nIndex = -1;
  10452. if(bAutoChangeSublocation && !isNullOrUndefined(user))
  10453. selectBCJODSublocation.value = (user.location.indexOf('Balack\'s Cove') > -1) ? 'LOW' : 'JOD';
  10454. nIndex = storageValue.order.indexOf(selectBCJODSublocation.value);
  10455. selectBCJODWeapon.value = storageValue.weapon[nIndex];
  10456. selectBCJODBase.value = storageValue.base[nIndex];
  10457. selectBCJODTrinket.value = storageValue.trinket[nIndex];
  10458. selectBCJODBait.value = storageValue.bait[nIndex];
  10459. }
  10460.  
  10461. function onSelectBWRiftForceActiveQuantum(){
  10462. saveBWRift();
  10463. initControlsBWRift();
  10464. }
  10465.  
  10466. function onSelectBWRiftForceDeactiveQuantum(){
  10467. saveBWRift();
  10468. initControlsBWRift();
  10469. }
  10470.  
  10471. function onInputRemaininigLootAChanged(input){
  10472. input.value = limitMinMax(input.value, input.min, input.max);
  10473. saveBWRift();
  10474. }
  10475.  
  10476. function onInputRemaininigLootDChanged(input){
  10477. input.value = limitMinMax(input.value, input.min, input.max);
  10478. saveBWRift();
  10479. }
  10480.  
  10481. function onSelectBWRiftChoosePortal(){
  10482. saveBWRift();
  10483. initControlsBWRift();
  10484. }
  10485.  
  10486. function onInputMinTimeSandChanged(input){
  10487. input.value = limitMinMax(input.value, input.min, input.max);
  10488. saveBWRift();
  10489. }
  10490.  
  10491. function onSelectBWRiftMinRSCType(){
  10492. saveBWRift();
  10493. initControlsBWRift();
  10494. }
  10495.  
  10496. function onInputMinRSCChanged(input){
  10497. input.value = limitMinMax(input.value, input.min, input.max);
  10498. saveBWRift();
  10499. }
  10500.  
  10501. function saveBWRift(){
  10502. var selectBWRiftChamber = document.getElementById('selectBWRiftChamber');
  10503. var selectBWRiftWeapon = document.getElementById('selectBWRiftWeapon');
  10504. var selectBWRiftBase = document.getElementById('selectBWRiftBase');
  10505. var selectBWRiftBait = document.getElementById('selectBWRiftBait');
  10506. var selectBWRiftTrinket = document.getElementById('selectBWRiftTrinket');
  10507. var selectBWRiftActivatePocketWatch = document.getElementById('selectBWRiftActivatePocketWatch');
  10508. var selectBWRiftCleaverStatus = document.getElementById('selectBWRiftCleaverStatus');
  10509. var selectBWRiftAlertLvl = document.getElementById('selectBWRiftAlertLvl');
  10510. var selectBWRiftWeaponSpecial = document.getElementById('selectBWRiftWeaponSpecial');
  10511. var selectBWRiftBaseSpecial = document.getElementById('selectBWRiftBaseSpecial');
  10512. var selectBWRiftBaitSpecial = document.getElementById('selectBWRiftBaitSpecial');
  10513. var selectBWRiftTrinketSpecial = document.getElementById('selectBWRiftTrinketSpecial');
  10514. var selectBWRiftActivatePocketWatchSpecial = document.getElementById('selectBWRiftActivatePocketWatchSpecial');
  10515. var selectBWRiftForceActiveQuantum = document.getElementById('selectBWRiftForceActiveQuantum');
  10516. var inputRemainingLootA = document.getElementById('inputRemainingLootA');
  10517. var selectBWRiftForceDeactiveQuantum = document.getElementById('selectBWRiftForceDeactiveQuantum');
  10518. var inputRemainingLootD = document.getElementById('inputRemainingLootD');
  10519. var selectBWRiftChoosePortal = document.getElementById('selectBWRiftChoosePortal');
  10520. var selectBWRiftChoosePortalAfterCC = document.getElementById('selectBWRiftChoosePortalAfterCC');
  10521. var selectBWRiftPriority = document.getElementById('selectBWRiftPriority');
  10522. var selectBWRiftPriorityCursed = document.getElementById('selectBWRiftPriorityCursed');
  10523. var selectBWRiftPortal = document.getElementById('selectBWRiftPortal');
  10524. var selectBWRiftBuffCurse = document.getElementById('selectBWRiftBuffCurse');
  10525. var inputMinTimeSand = document.getElementById('inputMinTimeSand');
  10526. var selectBWRiftMinRSCType = document.getElementById('selectBWRiftMinRSCType');
  10527. var inputMinRSC = document.getElementById('inputMinRSC');
  10528. var selectBWRiftEnterWCurse = document.getElementById('selectBWRiftEnterWCurse');
  10529. var storageValue = window.sessionStorage.getItem('BWRift');
  10530. if(isNullOrUndefined(storageValue))
  10531. storageValue = JSON.stringify(objDefaultBWRift);
  10532. storageValue = JSON.parse(storageValue);
  10533. var nIndexCursed = selectBWRiftChamber.value.indexOf('_CURSED');
  10534. var bCursed = (nIndexCursed > -1);
  10535. var strChamberName = (bCursed) ? selectBWRiftChamber.value.substr(0,nIndexCursed) : selectBWRiftChamber.value;
  10536. var nIndex = storageValue.order.indexOf(strChamberName);
  10537. if(nIndex < 0)
  10538. nIndex = 0;
  10539. if(bCursed)
  10540. nIndex += 16;
  10541. storageValue.master.weapon[nIndex] = selectBWRiftWeapon.value;
  10542. storageValue.master.base[nIndex] = selectBWRiftBase.value;
  10543. storageValue.master.bait[nIndex] = selectBWRiftBait.value;
  10544. storageValue.master.trinket[nIndex] = selectBWRiftTrinket.value;
  10545. storageValue.master.activate[nIndex] = (selectBWRiftActivatePocketWatch.value == 'true');
  10546. storageValue.specialActivate.forceActivate[nIndex] = (selectBWRiftForceActiveQuantum.value == 'true');
  10547. storageValue.specialActivate.remainingLootActivate[nIndex] = parseInt(inputRemainingLootA.value);
  10548. storageValue.specialActivate.forceDeactivate[nIndex] = (selectBWRiftForceDeactiveQuantum.value == 'true');
  10549. storageValue.specialActivate.remainingLootDeactivate[nIndex] = parseInt(inputRemainingLootD.value);
  10550. var strTemp = '';
  10551. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  10552. nIndex = selectBWRiftCleaverStatus.selectedIndex;
  10553. if(bCursed)
  10554. nIndex += 2;
  10555. if(strChamberName == 'GEARWORKS')
  10556. strTemp = 'gw';
  10557. else if(strChamberName == 'ANCIENT')
  10558. strTemp = 'al';
  10559. else
  10560. strTemp = 'rl';
  10561. }
  10562. else if(strChamberName == 'GUARD'){
  10563. nIndex = selectBWRiftAlertLvl.selectedIndex;
  10564. if(bCursed)
  10565. nIndex += 7;
  10566. strTemp = 'gb';
  10567. }
  10568. /*else if(strChamberName == 'INGRESS'){
  10569. nIndex = selectBWRiftFTC.selectedIndex;
  10570. if(bCursed)
  10571. nIndex += 4;
  10572. strTemp = 'ic';
  10573. }
  10574. else if(strChamberName == 'FROZEN'){
  10575. nIndex = selectBWRiftHunt.selectedIndex;
  10576. if(bCursed)
  10577. nIndex += 16;
  10578. strTemp = 'fa';
  10579. }*/
  10580. else
  10581. strTemp = 'master';
  10582. if(strTemp !== 'master'){
  10583. storageValue[strTemp].weapon[nIndex] = selectBWRiftWeaponSpecial.value;
  10584. storageValue[strTemp].base[nIndex] = selectBWRiftBaseSpecial.value;
  10585. storageValue[strTemp].bait[nIndex] = selectBWRiftBaitSpecial.value;
  10586. storageValue[strTemp].trinket[nIndex] = selectBWRiftTrinketSpecial.value;
  10587. if(selectBWRiftActivatePocketWatchSpecial.value == 'MASTER')
  10588. storageValue[strTemp].activate[nIndex] = selectBWRiftActivatePocketWatchSpecial.value;
  10589. else
  10590. storageValue[strTemp].activate[nIndex] = (selectBWRiftActivatePocketWatchSpecial.value == 'true');
  10591. }
  10592. storageValue.minRSCType = selectBWRiftMinRSCType.value;
  10593. storageValue.minRSC = parseInt(inputMinRSC.value);
  10594. storageValue.choosePortal = (selectBWRiftChoosePortal.value == 'true');
  10595. if(storageValue.choosePortal){
  10596. storageValue.choosePortalAfterCC = (selectBWRiftChoosePortalAfterCC.value == 'true');
  10597. storageValue.priorities[selectBWRiftPriority.selectedIndex] = selectBWRiftPortal.value;
  10598. storageValue.prioritiesCursed[selectBWRiftPriorityCursed.selectedIndex] = selectBWRiftPortalCursed.value;
  10599. nIndex = parseInt(selectBWRiftBuffCurse.value);
  10600. storageValue.minTimeSand[nIndex] = parseInt(inputMinTimeSand.value);
  10601. storageValue.enterMinigameWCurse = (selectBWRiftEnterWCurse.value == 'true');
  10602. }
  10603. window.sessionStorage.setItem('BWRift', JSON.stringify(storageValue));
  10604. }
  10605.  
  10606. function initControlsBWRift(bAutoChangeChamber){
  10607. if(isNullOrUndefined(bAutoChangeChamber))
  10608. bAutoChangeChamber = false;
  10609. var selectBWRiftChamber = document.getElementById('selectBWRiftChamber');
  10610. var selectBWRiftWeapon = document.getElementById('selectBWRiftWeapon');
  10611. var selectBWRiftBase = document.getElementById('selectBWRiftBase');
  10612. var selectBWRiftBait = document.getElementById('selectBWRiftBait');
  10613. var selectBWRiftTrinket = document.getElementById('selectBWRiftTrinket');
  10614. var selectBWRiftActivatePocketWatch = document.getElementById('selectBWRiftActivatePocketWatch');
  10615. var selectBWRiftCleaverStatus = document.getElementById('selectBWRiftCleaverStatus');
  10616. var selectBWRiftAlertLvl = document.getElementById('selectBWRiftAlertLvl');
  10617. var selectBWRiftWeaponSpecial = document.getElementById('selectBWRiftWeaponSpecial');
  10618. var selectBWRiftBaseSpecial = document.getElementById('selectBWRiftBaseSpecial');
  10619. var selectBWRiftBaitSpecial = document.getElementById('selectBWRiftBaitSpecial');
  10620. var selectBWRiftTrinketSpecial = document.getElementById('selectBWRiftTrinketSpecial');
  10621. var selectBWRiftActivatePocketWatchSpecial = document.getElementById('selectBWRiftActivatePocketWatchSpecial');
  10622. var selectBWRiftForceActiveQuantum = document.getElementById('selectBWRiftForceActiveQuantum');
  10623. var inputRemainingLootA = document.getElementById('inputRemainingLootA');
  10624. var selectBWRiftForceDeactiveQuantum = document.getElementById('selectBWRiftForceDeactiveQuantum');
  10625. var inputRemainingLootD = document.getElementById('inputRemainingLootD');
  10626. var selectBWRiftChoosePortal = document.getElementById('selectBWRiftChoosePortal');
  10627. var selectBWRiftChoosePortalAfterCC = document.getElementById('selectBWRiftChoosePortalAfterCC');
  10628. var selectBWRiftPriority = document.getElementById('selectBWRiftPriority');
  10629. var selectBWRiftPriorityCursed = document.getElementById('selectBWRiftPriorityCursed');
  10630. var selectBWRiftPortal = document.getElementById('selectBWRiftPortal');
  10631. var selectBWRiftBuffCurse = document.getElementById('selectBWRiftBuffCurse');
  10632. var inputMinTimeSand = document.getElementById('inputMinTimeSand');
  10633. var selectBWRiftMinRSCType = document.getElementById('selectBWRiftMinRSCType');
  10634. var inputMinRSC = document.getElementById('inputMinRSC');
  10635. var selectBWRiftEnterWCurse = document.getElementById('selectBWRiftEnterWCurse');
  10636. var storageValue = window.sessionStorage.getItem('BWRift');
  10637. if(isNullOrUndefined(storageValue))
  10638. storageValue = JSON.stringify(objDefaultBWRift);
  10639. storageValue = JSON.parse(storageValue);
  10640. var nIndex = -1;
  10641. var bCursed = false;
  10642. if(bAutoChangeChamber && !isNullOrUndefined(user) && user.location.indexOf('Bristle Woods Rift') > -1){
  10643. if(!(user.quests.QuestRiftBristleWoods.status_effects.un.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.un.indexOf('remove') > -1) ||
  10644. !(user.quests.QuestRiftBristleWoods.status_effects.fr.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.fr.indexOf('remove') > -1) ||
  10645. !(user.quests.QuestRiftBristleWoods.status_effects.st.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.st.indexOf('remove') > -1))
  10646. bCursed = true;
  10647. var nRemaining = user.quests.QuestRiftBristleWoods.progress_remaining;
  10648. if(nRemaining > 0){
  10649. var strName = user.quests.QuestRiftBristleWoods.chamber_name.split(' ')[0].toUpperCase();
  10650. if(strName == 'ACOLYTE'){
  10651. if(user.quests.QuestRiftBristleWoods.minigame.acolyte_chamber.obelisk_charge < 100)
  10652. nIndex = storageValue.order.indexOf('ACOLYTE_CHARGING');
  10653. else if(user.quests.QuestRiftBristleWoods.minigame.acolyte_chamber.acolyte_sand > 0)
  10654. nIndex = storageValue.order.indexOf('ACOLYTE_DRAINING');
  10655. else
  10656. nIndex = storageValue.order.indexOf('ACOLYTE_DRAINED');
  10657. }
  10658. else
  10659. nIndex = storageValue.order.indexOf(strName);
  10660. if(nIndex > -1)
  10661. selectBWRiftChamber.value = storageValue.order[nIndex];
  10662. }
  10663. else
  10664. selectBWRiftChamber.value = 'NONE';
  10665. if(bCursed)
  10666. selectBWRiftChamber.value += '_CURSED';
  10667. }
  10668. var nIndexCursed = selectBWRiftChamber.value.indexOf('_CURSED');
  10669. bCursed = (nIndexCursed > -1);
  10670. var strChamberName = (bCursed) ? selectBWRiftChamber.value.substr(0,nIndexCursed) : selectBWRiftChamber.value;
  10671. nIndex = storageValue.order.indexOf(strChamberName);
  10672. if(nIndex < 0)
  10673. nIndex = 0;
  10674. if(bCursed)
  10675. nIndex += 16;
  10676. selectBWRiftWeapon.value = storageValue.master.weapon[nIndex];
  10677. selectBWRiftBase.value = storageValue.master.base[nIndex];
  10678. selectBWRiftTrinket.value = storageValue.master.trinket[nIndex];
  10679. selectBWRiftBait.value = storageValue.master.bait[nIndex];
  10680. selectBWRiftActivatePocketWatch.value = (storageValue.master.activate[nIndex] === true) ? 'true' : 'false';
  10681. selectBWRiftForceActiveQuantum.value = (storageValue.specialActivate.forceActivate[nIndex] === true) ? 'true' : 'false';
  10682. inputRemainingLootA.value = storageValue.specialActivate.remainingLootActivate[nIndex];
  10683. inputRemainingLootA.disabled = (selectBWRiftForceActiveQuantum.value == 'true') ? '' : 'disabled';
  10684. selectBWRiftForceDeactiveQuantum.value = (storageValue.specialActivate.forceDeactivate[nIndex] === true) ? 'true' : 'false';
  10685. inputRemainingLootD.value = storageValue.specialActivate.remainingLootDeactivate[nIndex];
  10686. inputRemainingLootD.disabled = (selectBWRiftForceDeactiveQuantum.value == 'true') ? '' : 'disabled';
  10687. var strTemp = '';
  10688. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  10689. nIndex = selectBWRiftCleaverStatus.selectedIndex;
  10690. if(bCursed)
  10691. nIndex += 2;
  10692. if(strChamberName == 'GEARWORKS')
  10693. strTemp = 'gw';
  10694. else if(strChamberName == 'ANCIENT')
  10695. strTemp = 'al';
  10696. else
  10697. strTemp = 'rl';
  10698. selectBWRiftCleaverStatus.style.display = '';
  10699. selectBWRiftAlertLvl.style.display = 'none';
  10700. selectBWRiftFTC.style.display = 'none';
  10701. selectBWRiftHunt.style.display = 'none';
  10702. }
  10703. else if(strChamberName == 'GUARD'){
  10704. nIndex = selectBWRiftAlertLvl.selectedIndex;
  10705. if(bCursed)
  10706. nIndex += 7;
  10707. strTemp = 'gb';
  10708. selectBWRiftCleaverStatus.style.display = 'none';
  10709. selectBWRiftAlertLvl.style.display = '';
  10710. selectBWRiftFTC.style.display = 'none';
  10711. selectBWRiftHunt.style.display = 'none';
  10712. }
  10713. /*else if(strChamberName == 'INGRESS'){
  10714. nIndex = selectBWRiftFTC.selectedIndex;
  10715. if(bCursed)
  10716. nIndex += 4;
  10717. strTemp = 'ic';
  10718. selectBWRiftAlertLvl.style.display = 'none';
  10719. selectBWRiftFTC.style.display = '';
  10720. selectBWRiftHunt.style.display = 'none';
  10721. }
  10722. else if(strChamberName == 'FROZEN'){
  10723. nIndex = selectBWRiftHunt.selectedIndex;
  10724. if(bCursed)
  10725. nIndex += 16;
  10726. strTemp = 'fa';
  10727. selectBWRiftAlertLvl.style.display = 'none';
  10728. selectBWRiftFTC.style.display = 'none';
  10729. selectBWRiftHunt.style.display = '';
  10730. }*/
  10731. else{
  10732. strTemp = 'master';
  10733. selectBWRiftAlertLvl.style.display = 'none';
  10734. selectBWRiftFTC.style.display = 'none';
  10735. selectBWRiftHunt.style.display = 'none';
  10736. }
  10737. if(strTemp == 'master')
  10738. document.getElementById('trBWRiftTrapSetupSpecial').style.display = 'none';
  10739. else{
  10740. selectBWRiftWeaponSpecial.value = storageValue[strTemp].weapon[nIndex];
  10741. selectBWRiftBaseSpecial.value = storageValue[strTemp].base[nIndex];
  10742. selectBWRiftTrinketSpecial.value = storageValue[strTemp].trinket[nIndex];
  10743. selectBWRiftBaitSpecial.value = storageValue[strTemp].bait[nIndex];
  10744. if(storageValue[strTemp].activate[nIndex] == 'MASTER')
  10745. selectBWRiftActivatePocketWatchSpecial.value = storageValue[strTemp].activate[nIndex];
  10746. else
  10747. selectBWRiftActivatePocketWatchSpecial.value = (storageValue[strTemp].activate[nIndex] === true) ? 'true' : 'false';
  10748. document.getElementById('trBWRiftTrapSetupSpecial').style.display = '';
  10749. }
  10750. selectBWRiftChoosePortal.value = (storageValue.choosePortal === true) ? 'true' : 'false';
  10751. selectBWRiftChoosePortalAfterCC.value = (storageValue.choosePortalAfterCC === true) ? 'true' : 'false';
  10752. selectBWRiftPortal.value = storageValue.priorities[selectBWRiftPriority.selectedIndex];
  10753. selectBWRiftPortalCursed.value = storageValue.prioritiesCursed[selectBWRiftPriorityCursed.selectedIndex];
  10754. nIndex = parseInt(selectBWRiftBuffCurse.value);
  10755. inputMinTimeSand.value = storageValue.minTimeSand[nIndex];
  10756. selectBWRiftMinRSCType.value = storageValue.minRSCType;
  10757. inputMinRSC.value = storageValue.minRSC;
  10758. selectBWRiftEnterWCurse.value = (storageValue.enterMinigameWCurse === true) ? 'true' : 'false';
  10759. if(selectBWRiftChoosePortal.value == 'true'){
  10760. document.getElementById('trBWRiftChoosePortalAfterCC').style.display = '';
  10761. document.getElementById('trBWRiftPortalPriority').style.display = '';
  10762. document.getElementById('trBWRiftPortalPriorityCursed').style.display = '';
  10763. document.getElementById('trBWRiftMinTimeSand').style.display = '';
  10764. document.getElementById('trBWRiftEnterMinigame').style.display = '';
  10765. document.getElementById('trBWRiftMinRSC').style.display = '';
  10766. }
  10767. else{
  10768. document.getElementById('trBWRiftChoosePortalAfterCC').style.display = 'none';
  10769. document.getElementById('trBWRiftPortalPriority').style.display = 'none';
  10770. document.getElementById('trBWRiftPortalPriorityCursed').style.display = 'none';
  10771. document.getElementById('trBWRiftMinTimeSand').style.display = 'none';
  10772. document.getElementById('trBWRiftEnterMinigame').style.display = 'none';
  10773. document.getElementById('trBWRiftMinRSC').style.display = 'none';
  10774. }
  10775. inputMinRSC.style.display = (selectBWRiftMinRSCType.value == 'NUMBER') ? '' : 'none';
  10776. }
  10777.  
  10778. function saveFRox(){
  10779. var selectFRoxStage = document.getElementById('selectFRoxStage');
  10780. var selectFRoxWeapon = document.getElementById('selectFRoxWeapon');
  10781. var selectFRoxBase = document.getElementById('selectFRoxBase');
  10782. var selectFRoxBait = document.getElementById('selectFRoxBait');
  10783. var selectFRoxTrinket = document.getElementById('selectFRoxTrinket');
  10784. var selectFRoxActivateTower = document.getElementById('selectFRoxActivateTower');
  10785. var selectFRoxFullHPDeactivate = document.getElementById('selectFRoxFullHPDeactivate');
  10786. var storageValue = window.sessionStorage.getItem('FRox');
  10787. if(isNullOrUndefined(storageValue)){
  10788. var objDefaultFRox = {
  10789. stage : ['DAY','stage_one','stage_two','stage_three','stage_four','stage_five','DAWN'],
  10790. order : ['DAY','TWILIGHT','MIDNIGHT','PITCH','UTTER','FIRST','DAWN'],
  10791. weapon : new Array(7).fill(''),
  10792. base : new Array(7).fill(''),
  10793. trinket : new Array(7).fill('None'),
  10794. bait : new Array(7).fill('Gouda'),
  10795. activate : new Array(7).fill(false),
  10796. fullHPDeactivate : true
  10797. };
  10798. storageValue = JSON.stringify(objDefaultFRox);
  10799. }
  10800. storageValue = JSON.parse(storageValue);
  10801. var nIndex = storageValue.order.indexOf(selectFRoxStage.value);
  10802. if(nIndex < 0)
  10803. nIndex = 0;
  10804. storageValue.weapon[nIndex] = selectFRoxWeapon.value;
  10805. storageValue.base[nIndex] = selectFRoxBase.value;
  10806. storageValue.bait[nIndex] = selectFRoxBait.value;
  10807. storageValue.trinket[nIndex] = selectFRoxTrinket.value;
  10808. storageValue.activate[nIndex] = (selectFRoxActivateTower.value == 'true');
  10809. storageValue.fullHPDeactivate = (selectFRoxFullHPDeactivate.value == 'true');
  10810. window.sessionStorage.setItem('FRox', JSON.stringify(storageValue));
  10811. }
  10812.  
  10813. function initControlsFRox(bAutoChangeStage){
  10814. if(isNullOrUndefined(bAutoChangeStage))
  10815. bAutoChangeStage = false;
  10816. var selectFRoxStage = document.getElementById('selectFRoxStage');
  10817. var selectFRoxWeapon = document.getElementById('selectFRoxWeapon');
  10818. var selectFRoxBase = document.getElementById('selectFRoxBase');
  10819. var selectFRoxBait = document.getElementById('selectFRoxBait');
  10820. var selectFRoxTrinket = document.getElementById('selectFRoxTrinket');
  10821. var selectFRoxActivateTower = document.getElementById('selectFRoxActivateTower');
  10822. var selectFRoxFullHPDeactivate = document.getElementById('selectFRoxFullHPDeactivate');
  10823. var storageValue = window.sessionStorage.getItem('FRox');
  10824. if(isNullOrUndefined(storageValue)){
  10825. selectFRoxWeapon.selectedIndex = -1;
  10826. selectFRoxBase.selectedIndex = -1;
  10827. selectFRoxBait.selectedIndex = -1;
  10828. selectFRoxTrinket.selectedIndex = -1;
  10829. selectFRoxActivateTower.selectedIndex = -1;
  10830. selectFRoxFullHPDeactivate.selectedIndex = -1;
  10831. }
  10832. else{
  10833. storageValue = JSON.parse(storageValue);
  10834. var nIndex = -1;
  10835. if(bAutoChangeStage && !isNullOrUndefined(user) && user.location.indexOf('Fort Rox') > -1){
  10836. if(user.quests.QuestFortRox.is_dawn === true)
  10837. selectFRoxStage.value = 'DAWN';
  10838. else if(user.quests.QuestFortRox.current_phase == 'night'){
  10839. nIndex = storageValue.stage.indexOf(user.quests.QuestFortRox.current_stage);
  10840. if(nIndex > -1)
  10841. selectFRoxStage.value = storageValue.order[nIndex];
  10842. }
  10843. else if(user.quests.QuestFortRox.current_phase == 'day'){
  10844. selectFRoxStage.value = 'DAY';
  10845. }
  10846. }
  10847. nIndex = storageValue.order.indexOf(selectFRoxStage.value);
  10848. if(nIndex < 0)
  10849. nIndex = 0;
  10850. selectFRoxWeapon.value = storageValue.weapon[nIndex];
  10851. selectFRoxBase.value = storageValue.base[nIndex];
  10852. selectFRoxTrinket.value = storageValue.trinket[nIndex];
  10853. selectFRoxBait.value = storageValue.bait[nIndex];
  10854. selectFRoxActivateTower.value = (storageValue.activate[nIndex] === true) ? 'true' : 'false';
  10855. selectFRoxFullHPDeactivate.value = (storageValue.fullHPDeactivate === true) ? 'true' : 'false';
  10856. }
  10857. }
  10858.  
  10859. function onSelectWWRiftFaction(){
  10860. onInputMinRageChanged(document.getElementById('inputMinRage'));
  10861. }
  10862.  
  10863. function onInputMinRageChanged(input){
  10864. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10865. var nMin = (selectWWRiftFaction.value == 'MBW_45_48') ? 45 : input.min;
  10866. var nMax = (selectWWRiftFaction.value == 'MBW_40_44') ? 44 : input.max;
  10867. input.value = limitMinMax(input.value, nMin, nMax);
  10868. saveWWRift();
  10869. initControlsWWRift();
  10870. }
  10871.  
  10872. function saveWWRift(){
  10873. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10874. var selectWWRiftFactionNext = document.getElementById('selectWWRiftFactionNext');
  10875. var selectWWRiftRage = document.getElementById('selectWWRiftRage');
  10876. var selectWWRiftTrapWeapon = document.getElementById('selectWWRiftTrapWeapon');
  10877. var selectWWRiftTrapBase = document.getElementById('selectWWRiftTrapBase');
  10878. var selectWWRiftTrapTrinket = document.getElementById('selectWWRiftTrapTrinket');
  10879. var selectWWRiftTrapBait = document.getElementById('selectWWRiftTrapBait');
  10880. var selectWWRiftMBWBar4044 = document.getElementById('selectWWRiftMBWBar4044');
  10881. var selectWWRiftMBWBar4548 = document.getElementById('selectWWRiftMBWBar4548');
  10882. var selectWWRiftMBWTrapWeapon = document.getElementById('selectWWRiftMBWTrapWeapon');
  10883. var selectWWRiftMBWTrapBase = document.getElementById('selectWWRiftMBWTrapBase');
  10884. var selectWWRiftMBWTrapTrinket = document.getElementById('selectWWRiftMBWTrapTrinket');
  10885. var selectWWRiftMBWTrapBait = document.getElementById('selectWWRiftMBWTrapBait');
  10886. var inputMinRage = document.getElementById('inputMinRage');
  10887. var storageValue = window.sessionStorage.getItem('WWRift');
  10888. if(isNullOrUndefined(storageValue)){
  10889. var objDefaultWWRift = {
  10890. factionFocus : "CC",
  10891. factionFocusNext : "Remain",
  10892. faction : {
  10893. weapon : new Array(3).fill(''),
  10894. base : new Array(3).fill(''),
  10895. trinket : new Array(3).fill('None'),
  10896. bait : new Array(3).fill('None')
  10897. },
  10898. MBW : {
  10899. minRageLLC : 40,
  10900. rage4044: {
  10901. weapon : new Array(7).fill(''),
  10902. base : new Array(7).fill(''),
  10903. trinket : new Array(7).fill('None'),
  10904. bait : new Array(7).fill('None')
  10905. },
  10906. rage4548: {
  10907. weapon : new Array(8).fill(''),
  10908. base : new Array(8).fill(''),
  10909. trinket : new Array(8).fill('None'),
  10910. bait : new Array(8).fill('None')
  10911. },
  10912. },
  10913. };
  10914. storageValue = JSON.stringify(objDefaultWWRift);
  10915. }
  10916. storageValue = JSON.parse(storageValue);
  10917. storageValue.factionFocus = selectWWRiftFaction.value;
  10918. storageValue.factionFocusNext = selectWWRiftFactionNext.value;
  10919. var nIndex = selectWWRiftRage.selectedIndex;
  10920. if(nIndex < 0)
  10921. nIndex = 0;
  10922. storageValue.faction.weapon[nIndex] = selectWWRiftTrapWeapon.value;
  10923. storageValue.faction.base[nIndex] = selectWWRiftTrapBase.value;
  10924. storageValue.faction.trinket[nIndex] = selectWWRiftTrapTrinket.value;
  10925. storageValue.faction.bait[nIndex] = selectWWRiftTrapBait.value;
  10926. storageValue.MBW.minRageLLC = parseInt(inputMinRage.value);
  10927. if(selectWWRiftFaction.value == 'MBW_40_44'){
  10928. nIndex = selectWWRiftMBWBar4044.selectedIndex;
  10929. if(nIndex < 0)
  10930. nIndex = 0;
  10931. storageValue.MBW.rage4044.weapon[nIndex] = selectWWRiftMBWTrapWeapon.value;
  10932. storageValue.MBW.rage4044.base[nIndex] = selectWWRiftMBWTrapBase.value;
  10933. storageValue.MBW.rage4044.trinket[nIndex] = selectWWRiftMBWTrapTrinket.value;
  10934. storageValue.MBW.rage4044.bait[nIndex] = selectWWRiftMBWTrapBait.value;
  10935. }
  10936. else if(selectWWRiftFaction.value == 'MBW_45_48'){
  10937. nIndex = selectWWRiftMBWBar4548.selectedIndex;
  10938. if(nIndex < 0)
  10939. nIndex = 0;
  10940. storageValue.MBW.rage4548.weapon[nIndex] = selectWWRiftMBWTrapWeapon.value;
  10941. storageValue.MBW.rage4548.base[nIndex] = selectWWRiftMBWTrapBase.value;
  10942. storageValue.MBW.rage4548.trinket[nIndex] = selectWWRiftMBWTrapTrinket.value;
  10943. storageValue.MBW.rage4548.bait[nIndex] = selectWWRiftMBWTrapBait.value;
  10944. }
  10945. window.sessionStorage.setItem('WWRift', JSON.stringify(storageValue));
  10946. }
  10947.  
  10948. function initControlsWWRift(bAutoChangeRageLevel){
  10949. if(isNullOrUndefined(bAutoChangeRageLevel))
  10950. bAutoChangeRageLevel = false;
  10951. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10952. var selectWWRiftFactionNext = document.getElementById('selectWWRiftFactionNext');
  10953. var selectWWRiftRage = document.getElementById('selectWWRiftRage');
  10954. var selectWWRiftTrapWeapon = document.getElementById('selectWWRiftTrapWeapon');
  10955. var selectWWRiftTrapBase = document.getElementById('selectWWRiftTrapBase');
  10956. var selectWWRiftTrapTrinket = document.getElementById('selectWWRiftTrapTrinket');
  10957. var selectWWRiftTrapBait = document.getElementById('selectWWRiftTrapBait');
  10958. var selectWWRiftMBWBar4044 = document.getElementById('selectWWRiftMBWBar4044');
  10959. var selectWWRiftMBWBar4548 = document.getElementById('selectWWRiftMBWBar4548');
  10960. var selectWWRiftMBWTrapWeapon = document.getElementById('selectWWRiftMBWTrapWeapon');
  10961. var selectWWRiftMBWTrapBase = document.getElementById('selectWWRiftMBWTrapBase');
  10962. var selectWWRiftMBWTrapTrinket = document.getElementById('selectWWRiftMBWTrapTrinket');
  10963. var selectWWRiftMBWTrapBait = document.getElementById('selectWWRiftMBWTrapBait');
  10964. var inputMinRage = document.getElementById('inputMinRage');
  10965. var storageValue = window.sessionStorage.getItem('WWRift');
  10966. if(isNullOrUndefined(storageValue)){
  10967. selectWWRiftFaction.selectedIndex = -1;
  10968. selectWWRiftFactionNext.selectedIndex = 0;
  10969. selectWWRiftRage.selectedIndex = 0;
  10970. selectWWRiftTrapWeapon.selectedIndex = -1;
  10971. selectWWRiftTrapBase.selectedIndex = -1;
  10972. selectWWRiftTrapTrinket.selectedIndex = -1;
  10973. selectWWRiftTrapBait.selectedIndex = -1;
  10974. inputMinRage.value = 40;
  10975. selectWWRiftMBWBar4044.selectedIndex = 0;
  10976. selectWWRiftMBWBar4548.selectedIndex = 0;
  10977. selectWWRiftMBWTrapWeapon.selectedIndex = -1;
  10978. selectWWRiftMBWTrapBase.selectedIndex = -1;
  10979. selectWWRiftMBWTrapTrinket.selectedIndex = -1;
  10980. selectWWRiftMBWTrapBait.selectedIndex = -1;
  10981. }
  10982. else{
  10983. storageValue = JSON.parse(storageValue);
  10984. selectWWRiftFaction.value = storageValue.factionFocus;
  10985. selectWWRiftFactionNext.value = storageValue.factionFocusNext;
  10986. if(bAutoChangeRageLevel && !isNullOrUndefined(user) && user.location.indexOf('Whisker Woods Rift') > -1){
  10987. var arrOrder = ['CC', 'GGT', 'DL'];
  10988. var arrRage = new Array(3);
  10989. var classRage = document.getElementsByClassName('riftWhiskerWoodsHUD-zone-rageLevel');
  10990. for(var i=0;i<classRage.length;i++)
  10991. arrRage[i] = parseInt(classRage[i].textContent);
  10992. var temp = arrOrder.indexOf(storageValue.factionFocus);
  10993. if(temp != -1 && Number.isInteger(arrRage[temp]))
  10994. selectWWRiftRage.selectedIndex = Math.floor(arrRage[temp]/25);
  10995. }
  10996. var nIndex = (selectWWRiftRage.selectedIndex < 0) ? 0 : selectWWRiftRage.selectedIndex;
  10997. selectWWRiftTrapWeapon.value = storageValue.faction.weapon[nIndex];
  10998. selectWWRiftTrapBase.value = storageValue.faction.base[nIndex];
  10999. selectWWRiftTrapTrinket.value = storageValue.faction.trinket[nIndex];
  11000. selectWWRiftTrapBait.value = storageValue.faction.bait[nIndex];
  11001. inputMinRage.value = storageValue.MBW.minRageLLC;
  11002. var temp = '';
  11003. if(selectWWRiftFaction.value == 'MBW_40_44'){
  11004. nIndex = (selectWWRiftMBWBar4044.selectedIndex < 0) ? 0 : selectWWRiftMBWBar4044.selectedIndex;
  11005. temp = 'rage4044';
  11006. }
  11007. else if(selectWWRiftFaction.value == 'MBW_45_48'){
  11008. nIndex = (selectWWRiftMBWBar4548.selectedIndex < 0) ? 0 : selectWWRiftMBWBar4548.selectedIndex;
  11009. temp = 'rage4548';
  11010. }
  11011. if(temp !== ''){
  11012. selectWWRiftMBWTrapWeapon.value = storageValue.MBW[temp].weapon[nIndex];
  11013. selectWWRiftMBWTrapBase.value = storageValue.MBW[temp].base[nIndex];
  11014. selectWWRiftMBWTrapTrinket.value = storageValue.MBW[temp].trinket[nIndex];
  11015. selectWWRiftMBWTrapBait.value = storageValue.MBW[temp].bait[nIndex];
  11016. }
  11017. }
  11018. if(selectWWRiftFaction.value.indexOf('MBW') > -1){
  11019. selectWWRiftMBWBar4044.style.display = (selectWWRiftFaction.value == 'MBW_40_44') ? '' : 'none';
  11020. selectWWRiftMBWBar4548.style.display = (selectWWRiftFaction.value == 'MBW_40_44') ? 'none' : '';
  11021. document.getElementById('trWWRiftFactionFocusNext').style.display = 'none';
  11022. document.getElementById('trWWRiftMBWMinRage').style.display = 'table-row';
  11023. document.getElementById('trWWRiftMBWTrapSetup').style.display = 'table-row';
  11024. document.getElementById('trWWRiftTrapSetup').style.display = 'none';
  11025. }
  11026. else{
  11027. document.getElementById('trWWRiftFactionFocusNext').style.display = 'table-row';
  11028. document.getElementById('trWWRiftMBWMinRage').style.display = 'none';
  11029. document.getElementById('trWWRiftMBWTrapSetup').style.display = 'none';
  11030. document.getElementById('trWWRiftTrapSetup').style.display = 'table-row';
  11031. }
  11032. }
  11033.  
  11034. function onSelectGESSDLoadCrate(){
  11035. saveGES();
  11036. initControlsGES();
  11037. }
  11038.  
  11039. function onSelectGESRRRepellent(){
  11040. saveGES();
  11041. initControlsGES();
  11042. }
  11043.  
  11044. function onSelectGESDCStokeEngine(){
  11045. saveGES();
  11046. initControlsGES();
  11047. }
  11048.  
  11049. function saveGES(){
  11050. var selectGESStage = document.getElementById('selectGESStage');
  11051. var selectGESTrapWeapon = document.getElementById('selectGESTrapWeapon');
  11052. var selectGESTrapBase = document.getElementById('selectGESTrapBase');
  11053. var selectGESSDTrapTrinket = document.getElementById('selectGESSDTrapTrinket');
  11054. var selectGESRRTrapTrinket = document.getElementById('selectGESRRTrapTrinket');
  11055. var selectGESDCTrapTrinket = document.getElementById('selectGESDCTrapTrinket');
  11056. var selectGESTrapBait = document.getElementById('selectGESTrapBait');
  11057. var selectGESSDLoadCrate = document.getElementById('selectGESSDLoadCrate');
  11058. var inputMinCrate = document.getElementById('inputMinCrate');
  11059. var selectGESRRRepellent = document.getElementById('selectGESRRRepellent');
  11060. var inputMinRepellent = document.getElementById('inputMinRepellent');
  11061. var selectGESDCStokeEngine = document.getElementById('selectGESDCStokeEngine');
  11062. var inputMinFuelNugget = document.getElementById('inputMinFuelNugget');
  11063. var storageValue = window.sessionStorage.getItem('GES');
  11064. if(isNullOrUndefined(storageValue)){
  11065. var objDefaultGES = {
  11066. bLoadCrate : false,
  11067. nMinCrate : 11,
  11068. bUseRepellent : false,
  11069. nMinRepellent : 11,
  11070. bStokeEngine : false,
  11071. nMinFuelNugget : 20,
  11072. SD_BEFORE : {
  11073. weapon : '',
  11074. base : '',
  11075. trinket : '',
  11076. bait : ''
  11077. },
  11078. SD_AFTER : {
  11079. weapon : '',
  11080. base : '',
  11081. trinket : '',
  11082. bait : ''
  11083. },
  11084. RR : {
  11085. weapon : '',
  11086. base : '',
  11087. trinket : '',
  11088. bait : ''
  11089. },
  11090. DC : {
  11091. weapon : '',
  11092. base : '',
  11093. trinket : '',
  11094. bait : ''
  11095. },
  11096. WAITING : {
  11097. weapon : '',
  11098. base : '',
  11099. trinket : '',
  11100. bait : ''
  11101. }
  11102. };
  11103. storageValue = JSON.stringify(objDefaultGES);
  11104. }
  11105. storageValue = JSON.parse(storageValue);
  11106. var strStage = selectGESStage.value;
  11107. storageValue[strStage].weapon = selectGESTrapWeapon.value;
  11108. storageValue[strStage].base = selectGESTrapBase.value;
  11109. storageValue[strStage].bait = selectGESTrapBait.value;
  11110. if (strStage == 'RR')
  11111. storageValue[strStage].trinket = selectGESRRTrapTrinket.value;
  11112. else if (strStage == 'DC')
  11113. storageValue[strStage].trinket = selectGESDCTrapTrinket.value;
  11114. else
  11115. storageValue[strStage].trinket = selectGESTrapTrinket.value;
  11116. storageValue.bLoadCrate = (selectGESSDLoadCrate.value == 'true');
  11117. storageValue.nMinCrate = parseInt(inputMinCrate.value);
  11118. storageValue.bUseRepellent = (selectGESRRRepellent.value == 'true');
  11119. storageValue.nMinRepellent = parseInt(inputMinRepellent.value);
  11120. storageValue.bStokeEngine = (selectGESDCStokeEngine.value == 'true');
  11121. storageValue.nMinFuelNugget = parseInt(inputMinFuelNugget.value);
  11122. window.sessionStorage.setItem('GES', JSON.stringify(storageValue));
  11123. }
  11124.  
  11125. function initControlsGES(bAutoChangePhase){
  11126. if(isNullOrUndefined(bAutoChangePhase))
  11127. bAutoChangePhase = false;
  11128. var selectGESStage = document.getElementById('selectGESStage');
  11129. var selectGESTrapWeapon = document.getElementById('selectGESTrapWeapon');
  11130. var selectGESTrapBase = document.getElementById('selectGESTrapBase');
  11131. var selectGESTrapTrinket = document.getElementById('selectGESTrapTrinket');
  11132. var selectGESRRTrapTrinket = document.getElementById('selectGESRRTrapTrinket');
  11133. var selectGESDCTrapTrinket = document.getElementById('selectGESDCTrapTrinket');
  11134. var selectGESTrapBait = document.getElementById('selectGESTrapBait');
  11135. var selectGESSDLoadCrate = document.getElementById('selectGESSDLoadCrate');
  11136. var inputMinCrate = document.getElementById('inputMinCrate');
  11137. var selectGESRRRepellent = document.getElementById('selectGESRRRepellent');
  11138. var inputMinRepellent = document.getElementById('inputMinRepellent');
  11139. var selectGESDCStokeEngine = document.getElementById('selectGESDCStokeEngine');
  11140. var inputMinFuelNugget = document.getElementById('inputMinFuelNugget');
  11141. var storageValue = window.sessionStorage.getItem('GES');
  11142. if(bAutoChangePhase && !isNullOrUndefined(user) && user.location.indexOf('Gnawnian Express Station') > -1){
  11143. if(user.quests.QuestTrainStation.on_train){
  11144. var strCurrentPhase = '';
  11145. var classPhase = document.getElementsByClassName('box phaseName');
  11146. if(classPhase.length > 0 && classPhase[0].children.length > 1)
  11147. strCurrentPhase = classPhase[0].children[1].textContent;
  11148. if(strCurrentPhase == 'Supply Depot'){
  11149. selectGESStage.value = 'SD';
  11150. var nTurn = parseInt(document.getElementsByClassName('supplyHoarderTab')[0].textContent.substr(0, 1));
  11151. selectGESStage.value = (nTurn <= 0) ? 'SD_BEFORE' : 'SD_AFTER';
  11152. }
  11153. else if(strCurrentPhase == 'Raider River')
  11154. selectGESStage.value = 'RR';
  11155. else if(strCurrentPhase == 'Daredevil Canyon')
  11156. selectGESStage.value = 'DC';
  11157. }
  11158. else
  11159. selectGESStage.value = 'WAITING';
  11160. }
  11161. var strStage = selectGESStage.value;
  11162. if(isNullOrUndefined(storageValue)){
  11163. selectGESTrapWeapon.selectedIndex = -1;
  11164. selectGESTrapBase.selectedIndex = -1;
  11165. selectGESTrapTrinket.selectedIndex = -1;
  11166. selectGESRRTrapTrinket.selectedIndex = -1;
  11167. selectGESDCTrapTrinket.selectedIndex = -1;
  11168. selectGESTrapBait.selectedIndex = -1;
  11169. selectGESSDLoadCrate.selectedIndex = 0;
  11170. inputMinCrate.value = 11;
  11171. selectGESRRRepellent.selectedIndex = 0;
  11172. inputMinRepellent.value = 11;
  11173. selectGESDCStokeEngine.selectedIndex = 0;
  11174. inputMinFuelNugget.value = 20;
  11175. }
  11176. else{
  11177. storageValue = JSON.parse(storageValue);
  11178. selectGESTrapWeapon.value = storageValue[strStage].weapon;
  11179. selectGESTrapBase.value = storageValue[strStage].base;
  11180. selectGESTrapBait.value = storageValue[strStage].bait;
  11181. if(strStage == 'RR')
  11182. selectGESRRTrapTrinket.value = storageValue.RR.trinket;
  11183. else if(strStage == 'DC')
  11184. selectGESDCTrapTrinket.value = storageValue.DC.trinket;
  11185. else
  11186. selectGESTrapTrinket.value = storageValue[strStage].trinket;
  11187. selectGESSDLoadCrate.value = (storageValue.bLoadCrate === true) ? 'true' : 'false';
  11188. inputMinCrate.value = storageValue.nMinCrate;
  11189. selectGESRRRepellent.value = (storageValue.bUseRepellent === true) ? 'true' : 'false';
  11190. inputMinRepellent.value = storageValue.nMinRepellent;
  11191. selectGESDCStokeEngine.value = (storageValue.bStokeEngine === true) ? 'true' : 'false';
  11192. inputMinFuelNugget.value = storageValue.nMinFuelNugget;
  11193. }
  11194. if(strStage == 'RR'){
  11195. selectGESTrapTrinket.style.display = 'none';
  11196. selectGESRRTrapTrinket.style.display = '';
  11197. selectGESDCTrapTrinket.style.display = 'none';
  11198. }
  11199. else if(strStage == 'DC'){
  11200. selectGESTrapTrinket.style.display = 'none';
  11201. selectGESRRTrapTrinket.style.display = 'none';
  11202. selectGESDCTrapTrinket.style.display = '';
  11203. }
  11204. else{
  11205. selectGESTrapTrinket.style.display = '';
  11206. selectGESRRTrapTrinket.style.display = 'none';
  11207. selectGESDCTrapTrinket.style.display = 'none';
  11208. }
  11209. inputMinCrate.disabled = (selectGESSDLoadCrate.value == 'true') ? '' : 'disabled';
  11210. inputMinRepellent.disabled = (selectGESRRRepellent.value == 'true') ? '' : 'disabled';
  11211. inputMinFuelNugget.disabled = (selectGESDCStokeEngine.value == 'true') ? '' : 'disabled';
  11212. }
  11213.  
  11214. function showOrHideTr(algo){
  11215. var objTableRow = {
  11216. 'All LG Area' : {
  11217. arr : ['trLGTGAutoFill','trLGTGAutoPour','trPourTrapSetup','trCurseLiftedTrapSetup','trSaltedTrapSetup'],
  11218. init : function(data){initControlsLG(data);}
  11219. },
  11220. 'Sunken City Custom' : {
  11221. arr : ['trSCCustom','trSCCustomUseSmartJet'],
  11222. init : function(data){initControlsSCCustom(data);}
  11223. },
  11224. 'Labyrinth' : {
  11225. arr : ['trLabyrinth','trPriorities15','trPriorities1560','trPriorities60','trLabyrinthOtherHallway','trLabyrinthDisarm','trLabyrinthArmOtherBase', 'trLabyrinthDisarmCompass','trLabyrinthWeaponFarming'],
  11226. init : function(data){initControlsLaby(data);}
  11227. },
  11228. 'Fiery Warpath' : {
  11229. arr : ['trFWWave','trFWTrapSetup','trFW4TrapSetup','trFWStreak','trFWFocusType','trFWLastType','trFWSupportConfig'],
  11230. init : function(data){initControlsFW(data);}
  11231. },
  11232. 'Burroughs Rift Custom' : {
  11233. arr : ['trBRConfig','trBRToggle','trBRTrapSetup'],
  11234. init : function(data){initControlsBR(data);}
  11235. },
  11236. 'SG' : {
  11237. arr : ['trSGTrapSetup','trSGDisarmBait'],
  11238. init : function(data){initControlsSG(data);}
  11239. },
  11240. 'Zokor' : {
  11241. arr : ['trZokorTrapSetup'],
  11242. init : function(data){initControlsZokor(data);}
  11243. },
  11244. 'Furoma Rift' : {
  11245. arr : ['trFREnterBattery','trFRRetreatBattery','trFRTrapSetupAtBattery'],
  11246. init : function(data){initControlsFR(data);}
  11247. },
  11248. 'ZT' : {
  11249. arr : ['trZTFocus','trZTTrapSetup1st','trZTTrapSetup2nd'],
  11250. init : function(data){initControlsZT(data);}
  11251. },
  11252. 'Iceberg' : {
  11253. arr : ['trIceberg'],
  11254. init : function(data){initControlsIceberg(data);}
  11255. },
  11256. 'WWRift' : {
  11257. arr : ['trWWRiftFactionFocus', 'trWWRiftFactionFocusNext', 'trWWRiftTrapSetup', 'trWWRiftMBWTrapSetup', 'trWWRiftMBWMinRage'],
  11258. init : function(data){initControlsWWRift(data);}
  11259. },
  11260. 'GES' : {
  11261. arr : ['trGESTrapSetup', 'trGESSDLoadCrate', 'trGESRRRepellent', 'trGESDCStokeEngine'],
  11262. init : function(data){initControlsGES(data);}
  11263. },
  11264. 'Fort Rox' : {
  11265. arr : ['trFRoxTrapSetup', 'trFRoxDeactiveTower'],
  11266. init : function(data){initControlsFRox(data);}
  11267. },
  11268. 'GWH2016R' : {
  11269. arr : ['trGWHTrapSetup','trGWHTurboBoost','trGWHFlying','trGWHFlyingFirework','trGWHFlyingLand'],
  11270. init : function(data){initControlsGWH2016(data);}
  11271. },
  11272. 'Bristle Woods Rift' : {
  11273. arr : ['trBWRiftSubLocation','trBWRiftMasterTrapSetup','trBWRiftAutoChoosePortal','trBWRiftPortalPriority','trBWRiftPortalPriorityCursed','trBWRiftMinTimeSand','trBWRiftMinRSC','trBWRiftDeactivatePocketWatch','trBWRiftChoosePortalAfterCC','trBWRiftTrapSetupSpecial','trBWRiftEnterMinigame','trBWRiftActivatePocketWatch'],
  11274. init : function(data){initControlsBWRift(data);}
  11275. },
  11276. 'BC/JOD' : {
  11277. arr : ['trBCJODSubLocation', 'trBCJODTrapSetup'],
  11278. init : function(data){initControlsBCJOD(data);}
  11279. },
  11280. 'FG/AR' : {
  11281. arr : ['trFGARSubLocation', 'trFGARTrapSetup'],
  11282. init : function(data){initControlsFGAR(data);}
  11283. },
  11284. };
  11285. var i, temp;
  11286. for(var prop in objTableRow){
  11287. if(objTableRow.hasOwnProperty(prop)){
  11288. temp = (prop == algo) ? 'table-row' : 'none';
  11289. for(i=0;i<objTableRow[prop].arr.length;i++)
  11290. document.getElementById(objTableRow[prop].arr[i]).style.display = temp;
  11291. }
  11292. }
  11293. if(!isNullOrUndefined(objTableRow[algo]))
  11294. objTableRow[algo].init(true);
  11295.  
  11296. initControlsMapHunting();
  11297. initControlsSpecialFeature();
  11298. }
  11299. }
  11300. // ################################################################################################
  11301. // HTML Function - End
  11302. // #################################################################################################
Add Comment
Please, Sign In to add comment