Advertisement
Guest User

Untitled

a guest
Aug 17th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (Array.prototype.clear == null) Array.prototype.clear = function ()
  2. {
  3.     this.splice(0, this.length);
  4. }
  5. if (String.prototype.format == null) String.prototype.format = function ()
  6. {
  7.     var a = arguments;
  8.     if (a.length == 1 && typeof (a[0]) == "object" && a[0].constructor == Array) a = a[0];
  9.     var t = this;
  10.     for (var num1 = 0; num1 < a.length; num1++) if (a[num1] != null) t = t.replace(new RegExp("\\{" + num1 + "\\}", "gm"), a[num1]);
  11.     return t;
  12. }
  13. if (String.prototype.trim == null) String.prototype.trim = function ()
  14. {
  15.     return this.replace(/^\s+|\s+$/gm, "");
  16. }
  17. if (String.prototype.beginsWith == null) String.prototype.beginsWith = function (text)
  18. {
  19.     return this.indexOf(text) == 0;
  20. }
  21. if (String.prototype.endsWith == null) String.prototype.endsWith = function (text)
  22. {
  23.     return this.lastIndexOf(text) == this.length - text.length;
  24. }
  25.  
  26. function $x(path, method, element)
  27. {
  28.     return (element ? element.ownerDocument : document).evaluate(path, element || document, null, method || 0, null);
  29. }
  30.  
  31. function $x1(path, element)
  32. {
  33.     return $x(path, 9, element).singleNodeValue;
  34. }
  35.  
  36. function $xa(path, method, element)
  37. {
  38.     var x = $x(path, method, element);
  39.     switch (x.resultType)
  40.     {
  41.     case 4:
  42.     case 5:
  43.         for (var num1 = 0, obj1 = null;
  44.         (obj1 = x.iterateNext()) != null; num1++)
  45.         {
  46.             x[num1] = obj1;
  47.             x.length = num1 + 1;
  48.         }
  49.         break;
  50.     case 6:
  51.     case 7:
  52.         x.length = x.snapshotLength;
  53.         for (var num1 = 0; num1 < x.length; num1++) x[num1] = x.snapshotItem(num1);
  54.         break;
  55.     }
  56.     return x;
  57. }
  58.  
  59. function $nc(nameclass, element)
  60. {
  61.     var r = (element ? element : document).getElementsByName(nameclass);
  62.     if (r.length == 0) r = (element ? element : document).getElementsByClassName(nameclass);
  63.     if (r.length == 0) r = null;
  64.     return r;
  65. }
  66.  
  67. function $inc1(idnameclass, element)
  68. {
  69.     var r = (element ? element.ownerDocument : document).getElementById(idnameclass);
  70.     if (r == null)
  71.     {
  72.         r = $nc(idnameclass, element);
  73.         if (r) r = r[0];
  74.     }
  75.     return r;
  76. }
  77.  
  78. function $ce(tag, textContent, attributes)
  79. {
  80.     var e = document.createElement(tag);
  81.     if (textContent) e.textContent = textContent;
  82.     if (attributes) for (var name in attributes) e.setAttribute(name, attributes[name]);
  83.     return e;
  84. }
  85.  
  86. function stringToHTML(html)
  87. {
  88.     var div1 = $inc1("HiddenDivStringToHtml");
  89.     if (div1 == null)
  90.     {
  91.         div1 = $ce("div", null, {
  92.             id: "HiddenDivStringToHtml",
  93.             style: "display:none;visibility:hidden;position:absolute;top:-1000px;left:-1000px;"
  94.         });
  95.         document.body.appendChild(div1);
  96.     }
  97.     div1.innerHTML = html;
  98.     var element1 = div1.firstChild;
  99.     if (element1) div1.removeChild(element1);
  100.     return element1;
  101. }
  102.  
  103. var bonusFactor = 1.5;
  104. var playerName = "Hero";
  105. var playerType = 0;
  106. var chainWihsingWells = 6;
  107. var logLevel = 5;
  108.  
  109. function log(message, level)
  110. {
  111.     if (logLevel == 0 || (logLevel && logLevel <= level)) GM_log(message);
  112. }
  113.  
  114. function promptDebug(code)
  115. {
  116.     var result = null;
  117.     while (code)
  118.     {
  119.         code = prompt(result, code);
  120.         try
  121.         {
  122.             result = eval(code);
  123.         }
  124.         catch (ex)
  125.         {
  126.             result = ex.message;
  127.         }
  128.     }
  129. }
  130.  
  131. function debugFunction(functionCall)
  132. {
  133.     var curLogLevel = logLevel;
  134.     logLevel = 0;
  135.     log("Debuging function: " + functionCall);
  136.     try
  137.     {
  138.         return result = eval(functionCall);
  139.     }
  140.     finally
  141.     {
  142.         logLevel = curLogLevel
  143.     };
  144. }
  145.  
  146. puzzleSolverEnabled = false;
  147.  
  148. function setPuzzleSolverEnabled(enabled)
  149. {
  150.     puzzleSolverEnabled = enabled;
  151.     var b = $inc1("puzzleSolver");
  152.     if (b)
  153.     {
  154.         if (/Disable/.test(b.value) != enabled)
  155.         {
  156.             log("Changing puzle solver ...");
  157.             clickElement(b);
  158.         }
  159.     }
  160.     return b;
  161. }
  162.  
  163. function setAutofightEnabled(enabled)
  164. {
  165.     var b = $inc1("disableauto");
  166.     if (b && b.checked == enabled) clickElement(b);
  167. }
  168.  
  169. if ($inc1("bodydiv"))
  170. {
  171.     log("starting up ...");
  172.     if (/dream\/enter/.test(location.href))
  173.     {
  174.         getData().entryPoint = location.href;
  175.         setData();
  176.     }
  177.     createGUI();
  178.     removeAlertFunction();
  179.     mainloop();
  180. }
  181.  
  182. function removeAlertFunction()
  183. {
  184.     unsafeWindow.alert = function (msg)
  185.     {
  186.         setTimeout(log, 0, "Alert: " + msg);
  187.     }
  188. }
  189.  
  190. function createGUI()
  191. {
  192.     if (!$inc1("autoplay") && $inc1("bodydiv"))
  193.     {
  194.         log("create GUI");
  195.         var options = getOptions();
  196.         var div = document.createElement("div");
  197.         div.setAttribute("style", "position:absolute;left:0px;top:0px;z-index:1000;background:white;border:solid 1px black;padding:1px;color:black;");
  198.         div.innerHTML = "<input type='checkbox' id='autoplay' name='autoplay' " + (options.autoplay ? "checked='checked'" : "") + "/><label for='autoplay'>Autoplay</label>&nbsp;<select id='method' name='method'><option value='autoFight()' " + (options.method == "autoFight()" ? "selected='selected'" : "") + ">Auto Fight</option><option value='fightWithSkillProtected()' " + (options.method == "fightWithSkillProtected()" ? "selected='selected'" : "") + ">Fight With Skill Protected</option><option value='fightDemons()' " + (options.method == "fightDemons()" ? "selected='selected'" : "") + ">Fight Demons</option><option value='fightBoss()' " + (options.method == "fightBoss()" ? "selected='selected'" : "") + ">Fight Mother Ship</option><option value='fightBoss1()' " + (options.method == "fightBoss1()" ? "selected='selected'" : "") + ">Fight Isendel </option><option value='searchForMoney()' " + (options.method == "searchForMoney()" ? "selected='selected'" : "") + ">Search For Money</option><option value='searchForPills()' " + (options.method == "searchForPills()" ? "selected='selected'" : "") + ">Search For Pills</option><option value='chainMoneyWells()' " + (options.method == "chainMoneyWells()" ? "selected='selected'" : "") + ">Chain Money Wells</option></select>&nbsp;<input type='checkbox' id='debug' name='debug'/><a id='promptDebug' href='javascript:void(0);'>Debug</a><br/><span id='info'/>";
  199.         document.body.appendChild(div);
  200.         $inc1("autoplay").addEventListener("click", function (e)
  201.         {
  202.             getOptions().autoplay = e.target.checked;
  203.             setData();
  204.         }, false);
  205.         $inc1("method").addEventListener("change", function (e)
  206.         {
  207.             getOptions().method = e.target.value;
  208.             getQueue().clear();
  209.             setData();
  210.         }, false);
  211.         $inc1("promptDebug").addEventListener("click", function (e)
  212.         {
  213.             promptDebug("true");
  214.         }, false);
  215.     }
  216. }
  217.  
  218. function setInfo(text)
  219. {
  220.     var el = $inc1("info");
  221.     if (el) el.textContent = text;
  222. }
  223.  
  224. var mainlooptimeout = 1000;
  225.  
  226. function mainloop()
  227. {
  228.     //log("mainloop");
  229.     try
  230.     {
  231.         var options = getOptions();
  232.         if (options.autoplay) eval(options.method);
  233.     }
  234.     catch (e)
  235.     {
  236.         log(e.message + "\n" + e.stackTrace);
  237.     }
  238.     setTimeout(mainloop, mainlooptimeout);
  239.     mainlooptimeout = 1000;
  240. }
  241.  
  242. function isLoading()
  243. {
  244.     var flag = unsafeWindow.requestPending;
  245.     var state = getState();
  246.     state.isLoading = flag ? state.isLoading + 1 : 0;
  247.     setData();
  248.     if (state.isLoading == 6) reload();
  249.     return flag;
  250. }
  251.  
  252. function fightWithSkillProtected()
  253. {
  254.     if (isLoading()) return;
  255.     setAutofightEnabled(false);
  256.     if (sword == null) sword = getCurrentWeapon().textContent;
  257.     if (!executeCommandsInQueue())
  258.     {
  259.         addToQueue(["initFullProtection()", "fullProtection()", "equipSword()", "fightWithSkill(0)", "clickExploreOrWait()"]);
  260.     }
  261. }
  262.  
  263. var aimed = false;
  264. var guarded = false;
  265. var shielded = false;
  266.  
  267. function fullProtection()
  268. {
  269.     if (!shielded) shielded = shield();
  270.     else if (!guarded) guarded = guard();
  271.     else if (!aimed) aimed = aim();
  272.     return aimed && guarded && shielded ? true : null;
  273. }
  274.  
  275. function initFullProtection()
  276. {
  277.     return !(aimed = guarded = shielded = false);
  278. }
  279.  
  280. function fightDemons()
  281. {
  282.     if (isLoading()) return;
  283.     setAutofightEnabled(false);
  284.     if (!executeCommandsInQueue())
  285.     {
  286.         addToQueue(["fightWithSkillOrRefillSkillPoints(2)", "clickExploreOrWait()"]);
  287.     }
  288. }
  289.  
  290. function fightBoss()
  291. {
  292.     if (isLoading()) return;
  293.     //exploreCommand = "clickExploreOrWait(5)";
  294.     //fightCommand = "fightWithNormalAttackAndDisposeItem()";
  295.     setAutofightEnabled(false);
  296.     setPuzzleSolverEnabled(puzzleSolverEnabled);
  297.     if (!executeCommandsInQueue())
  298.     {
  299.         var queue = null;
  300.         if ($inc1("dailychest")) openDailyFreeChest();
  301.         else if ($inc1("reviewdiv")) queue = ["clickPlayNow()"];//"showDivTown('/dream/worldmap')"
  302.         //loadDiv('/dream/invasion?town=4');
  303.         else if ($inc1("townsign"))
  304.         {/*"clickButton('fight)",*/
  305.             queue = ["clickButton('World Map')", "clickButton('Fight', 3)"];
  306.         }
  307.         else if ($inc1("mobnamespan").innerHTML == "Alien Mothership")
  308.         {
  309.             addToQueue(["fightWithSkillOrRefillSkillPointsMS(-1)", "clickButton('Continue')"]);
  310.         }// with the fight WIthSkillOrRefillSkillPointsMS(-1) means that it will fight with the skill -1 you dont realy need to know what the skill is its just gaming term but say i have 1000 skill points and this checks if i have enough skill points to use them or should it refill so we will go to that function fightWithSkillOrRefillSkillPointsMS(skill)
  311.         else
  312.         {
  313.             addToQueue(["fightWithSkillOrRefillSkillPointsMS(2)", "clickButton('Continue')"]);
  314.         }
  315.  
  316.         addToQueue(queue);
  317.     }
  318. }
  319. function fightBoss1()
  320. {
  321.     if (isLoading()) return;
  322.     setAutofightEnabled(false);
  323.     if (!executeCommandsInQueue())
  324.     {
  325.         if ($inc1("mobnamespan").innerHTML == "elite sorceress")
  326.         {
  327.             addToQueue(["fightWithSkillOrRefillSkillPoints(8)", "clickButton('Explore')"]);
  328.             //6
  329.         }
  330.         else if ($inc1("mobnamespan").innerHTML == "elite assassin")
  331.         {
  332.             addToQueue(["fightWithSkillOrRefillSkillPoints(8)", "clickButton('Explore')"]);
  333.             //6
  334.         }
  335.         else if ($inc1("mobnamespan").innerHTML == "xypher dragon")
  336.         {
  337.             addToQueue(["fightWithSkillOrRefillSkillPoints(8)", "clickButton('Explore')"]);
  338.             //6
  339.         }
  340.         else if ($inc1("mobnamespan").innerHTML == "fossil vulture")
  341.         {
  342.             addToQueue(["fightWithSkillOrRefillSkillPoints(6)", "clickButton('Explore')"]);
  343.             //5
  344.         }
  345.         else if ($inc1("mobnamespan").innerHTML == "xypher spirit")
  346.         {
  347.             addToQueue(["fightWithSkillOrRefillSkillPoints(6)", "clickButton('Explore')"]);
  348.             //5
  349.         }
  350.         else if ($inc1("mobnamespan").innerHTML == "Nahazir")
  351.         {
  352.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  353.             //6
  354.         }
  355.         else if ($inc1("mobnamespan").innerHTML == "Lust")
  356.         {
  357.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  358.             //6
  359.         }
  360.         else if ($inc1("mobnamespan").innerHTML == "Greed")
  361.         {
  362.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  363.             //6
  364.         }
  365.         else if ($inc1("mobnamespan").innerHTML == "Gluttony")
  366.         {
  367.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  368.             //6
  369.         }
  370.         else if ($inc1("mobnamespan").innerHTML == "Acedia")
  371.         {
  372.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  373.             //6
  374.         }
  375.         else if ($inc1("mobnamespan").innerHTML == "Wrath")
  376.         {
  377.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  378.             //6
  379.         }
  380.         else if ($inc1("mobnamespan").innerHTML == "Envy")
  381.         {
  382.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  383.             //6
  384.         }
  385.         else if ($inc1("mobnamespan").innerHTML == "Pride")
  386.         {
  387.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  388.             //6
  389.         }
  390.         else if ($inc1("mobnamespan").innerHTML == "Vainglory")
  391.         {
  392.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  393.             //6
  394.         }
  395.         else if ($inc1("mobnamespan").innerHTML == "Queen Haderon" || $inc1("mobnamespan").innerHTML == "Elderonoak" || $inc1("mobnamespan").innerHTML == "Crystal Lord" || $inc1("mobnamespan").innerHTML == "Neocorn King" || $inc1("mobnamespan").innerHTML == "Fallen")
  396.         {
  397.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Attack Again')"]);
  398.         }
  399.         else
  400.         {
  401.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  402.         }
  403.     }
  404. }
  405.  
  406. function fightWithSkillOrRefillSkillPoints(skill)
  407. {
  408.     return getCursp() < 20 ? refillSkillPoints() : fightWithSkill(skill)
  409. }
  410. function fightWithSkillOrRefillSkillPointsMS(skill)
  411. {
  412.     return getCursp() < 20 ? refillSkillPointsMS() : fightWithSkill(skill)
  413. }// getCursp() basicaly gets the current skillpoints then checks to see if its below 20 which works fine onto refillSkillPointsMS() function
  414.  
  415. var exploreCommand = null;
  416. var fightCommand = null;
  417.  
  418. function autoFight()
  419. {
  420.     if (isLoading()) return;
  421.     exploreCommand = "clickExploreOrWait(5)";
  422.     fightCommand = "fightWithNormalAttackAndDisposeItem()";
  423.     setAutofightEnabled(false);
  424.     setPuzzleSolverEnabled(puzzleSolverEnabled);
  425.     if (!executeCommandsInQueue())
  426.     {
  427.         var queue = null;
  428.         if ($inc1("dailychest")) openDailyFreeChest();
  429.         else if ($inc1("reviewdiv")) queue = ["clickPlayNow()"];
  430.         else if ($inc1("townsign")) queue = ["goToDungeon()", exploreCommand];
  431.         else if ($inc1("enctext"))
  432.         {
  433.             var mob = $inc1("mobname");
  434.             log("Special encounter: " + mob.textContent, 5);
  435.             switch (mob.textContent)
  436.             {
  437.             case "A Beggar":
  438.                 queue = ["getEnergyOrNothing()", exploreCommand];
  439.                 break;
  440.             case "A Puzzle Box":
  441.                 queue = ["clickButton('Open')", "solvePuzzleBox()", exploreCommand];
  442.                 break;
  443.             case "A Treasure Chest":
  444.                 queue = ["clickButton('Open')", "solveTreasureChestAndDisposeItem()", exploreCommand];
  445.                 break;
  446.             case "A Treasure Map":
  447.                 queue = ["clickButton('Find')", "getTreasureMapResultAndDisposeItem()", exploreCommand];
  448.                 break;
  449.             case "Dust Merchant":
  450.                 queue = ["clickButton('Fight')", "fightWithSkill(6)", exploreCommand];
  451.                 break;
  452.             case "Girl in Red":
  453.                 queue = ["emptyTurn()", "fightWithSkill(8)", exploreCommand];
  454.                 break;
  455.             case "Guardian of Dreams":
  456.                 queue = ["clickButton('Fight')", "fightWithSkill(8)", "getGuardianOfDreamsResultAndDisposeItem()", exploreCommand];
  457.                 break;
  458.             case "Little Imp":
  459.                 queue = ["clickButton('Accept')", "emptyTurn()", exploreCommand];
  460.                 break;
  461.             case "Magic Elf":
  462.                 queue = ["clickButton('Attack')", "fightWithSkill(8)", "getFightResultAndDisposeItem()", exploreCommand];
  463.                 break;
  464.                 // case "New Ally":
  465.                 // break;
  466.             case "Magic Mushrooms":
  467.                 queue = ["clickButton('Taste')", "getMagicMushroomResult()", exploreCommand];
  468.                 break;
  469.                 // case "Santa":
  470.                 // queue=["clickButton('Ask for gift')","getSantaResultAndDisposeItem()",exploreCommand];
  471.                 // break;
  472.             case "The Gambler":
  473.                 queue = ["clickButton('Fight')", "fightWithSkill(6)", exploreCommand];
  474.                 break;
  475.             case "The Wiseman":
  476.                 queue = ["killOrAccept()", exploreCommand];
  477.                 break;
  478.             case "Wishing Well":
  479.                 queue = ["getEnergyOrDive()", "getWishingWellResultStatistics()", exploreCommand];
  480.                 break;
  481.             default:
  482.                 log("default");
  483.                 queue = [exploreCommand];
  484.                 break;
  485.             }
  486.         }
  487.         else if ($inc1("mobnamespan").innerHTML == "rebel fighter")
  488.         {
  489.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  490.             //1
  491.         }
  492.         else if ($inc1("mobnamespan").innerHTML == "elite scout")
  493.         {
  494.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  495.             //1
  496.         }
  497.         else if ($inc1("mobnamespan").innerHTML == "rebel knight")
  498.         {
  499.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  500.             //1
  501.         }
  502.         else if ($inc1("mobnamespan").innerHTML == "brain lord")
  503.         {
  504.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  505.             //1
  506.         }
  507.         else if ($inc1("mobnamespan").innerHTML == "android-m3")
  508.         {
  509.             addToQueue(["fightWithSkillOrRefillSkillPoints(1)", "clickButton('Explore')"]);
  510.             //1
  511.         }
  512.         else if ($inc1("mobnamespan").innerHTML == "elite sorceress")
  513.         {
  514.             addToQueue(["fightWithSkillOrRefillSkillPoints(5)", "clickButton('Explore')"]);
  515.             //6
  516.         }
  517.         else if ($inc1("mobnamespan").innerHTML == "elite assassin")
  518.         {
  519.             addToQueue(["fightWithSkillOrRefillSkillPoints(5)", "clickButton('Explore')"]);
  520.             //6
  521.         }
  522.         else if ($inc1("mobnamespan").innerHTML == "xypher dragon")
  523.         {
  524.             addToQueue(["fightWithSkillOrRefillSkillPoints(5)", "clickButton('Explore')"]);
  525.             //6
  526.         }
  527.         else if ($inc1("mobnamespan").innerHTML == "fossil vulture")
  528.         {
  529.             addToQueue(["fightWithSkillOrRefillSkillPoints(3)", "clickButton('Explore')"]);
  530.             //5
  531.         }
  532.         else if ($inc1("mobnamespan").innerHTML == "xypher spirit")
  533.         {
  534.             addToQueue(["fightWithSkillOrRefillSkillPoints(3)", "clickButton('Explore')"]);
  535.             //5
  536.         }
  537.         else
  538.         {
  539.             addToQueue(["fightWithSkillOrRefillSkillPoints(-1)", "clickButton('Explore')"]);
  540.         }
  541.  
  542.         addToQueue(queue);
  543.     }
  544. }
  545.  
  546. function openDailyFreeChest()
  547. {
  548.     addToQueue(["clickButton('Open')", "clickButton('Close')", "tryClickButton('Close')"]);
  549. }
  550.  
  551. function killOrAccept()
  552. {
  553.     var result = null;
  554.     var state = getState();
  555.     if (state.questMob != "The Wiseman") result = clickButton('Accept');
  556.     else
  557.     {
  558.         state.questMob = null;
  559.         setData();
  560.         result = clickButton('Fight');
  561.         if (result) addToQueue([fightCommand], false, true);
  562.     }
  563.     return result;
  564. }
  565.  
  566. function getGirlInRedQuest()
  567. {
  568.     var result = getGirlInRedQuestResult();
  569.     if (result)
  570.     {
  571.         var state = getState();
  572.         state.questMob = result[2];
  573.         setData();
  574.     }
  575.     return result;
  576. }
  577.  
  578. function getItemOtNothing()
  579. {
  580.     var result = getCurcoins() > getHighCoins() ? giveCoinsToBeggar(getHighCoins()) : true;
  581.     return result;
  582. }
  583.  
  584. function getEnergyOrNothing()
  585. {
  586.     var result = getCurcoins() > getLowCoins() ? giveCoinsToBeggar(getLowCoins()) : giveCoinsToBeggar(getLowCoins());
  587.     return result;
  588. }
  589.  
  590. function getEnergyOrDive()
  591. {
  592.     var result = getCurcoins() > getLowCoins() ? throwCoinsInWell(getLowCoins()) : clickButton("Dive In");
  593.     return result;
  594. }
  595.  
  596. function clickExploreOrBuyMist(index)
  597. {
  598.     if (getCurenergy() == 0 && getCurcoins() > 10000000) return addToQueue(["goToTown()", "clickButton('healer')", "buyMist()", "clickButton('Back to Town')"]);
  599.     return clickExploreOrWait(index);
  600. }
  601.  
  602. function buyMist()
  603. {
  604.     var result = true;
  605.     if (getCurcoins() > 10000000)
  606.     {
  607.         result = clickButton("Use");
  608.         if (getCurenergy() < getCurmaxenergy() - 1)
  609.         {
  610.             resetQueueFailedRepeatedCommand();
  611.             result = null;
  612.         }
  613.     }
  614.     return result;
  615. }
  616.  
  617. function fightWithNormalAttackAndDisposeItem()
  618. {
  619.     result = fightWithSkillOrRefillSkillPoints(-1);
  620.     if (result)
  621.     {
  622.         freeInventoryFromUselessItems(result[1]);
  623.         var quest = getQuestEndResult();
  624.         if (quest) freeInventoryFromUselessItems(quest[2]);
  625.     }
  626.     return result;
  627. }
  628.  
  629. function getFightResultAndDisposeItem()
  630. {
  631.     var result = getFightResult();
  632.     if (result) freeInventoryFromUselessItems(result[1]);
  633.     return result;
  634. }
  635.  
  636. function getGuardianOfDreamsResultAndDisposeItem()
  637. {
  638.     var result = getGuardianOfDreamsResult();
  639.     if (result) freeInventoryFromUselessItems(result[1]);
  640.     return result;
  641. }
  642.  
  643. function getSantaResultAndDisposeItem()
  644. {
  645.     var result = getSantaResult();
  646.     if (result) freeInventoryFromUselessItems(result[1]);
  647.     return result;
  648. }
  649.  
  650. function getTreasureMapResultAndDisposeItem()
  651. {
  652.     var result = getTreasureMapResult();
  653.     if (result) freeInventoryFromUselessItems(result[1]);
  654.     return result;
  655. }
  656.  
  657. function solveTreasureChestAndDisposeItem()
  658. {
  659.     var result = solveTreasureChest();
  660.     if (result) freeInventoryFromUselessItems(result[1]);
  661.     return result;
  662. }
  663.  
  664. function getMysteryBoxResultAndDisposeItem()
  665. {
  666.     var result = getMysteryBoxResult();
  667.     if (result) freeInventoryFromUselessItems(result[1]);
  668.     return result;
  669. }
  670.  
  671. function freeInventoryFromUselessItems(text)
  672. {
  673.     text = text.trim();
  674.     if (isFinite(parseInt(text.replace(/,/gm, "")))) return; //it's a number --> coins!
  675.     var el = $x1("//a[contains(text(),\"" + text + "\")]/@onmouseover");
  676.     log("freeInventoryFromUselessItems: " + text, 5);
  677.     //log("quick inventory item: "+el,5);
  678.     if (text == "fairy dust") openInventoryAndUseItem("fairy dust");
  679.     else if (text == "enchant potion") openInventoryAndUseItem("enchant potion", ["enchantWeapon()"]);
  680.     else if (text == "mystery box") openInventoryAndUseItem("mystery box", ["getMysteryBoxResultAndDisposeItem()"]);
  681.     else if (el != null)
  682.     {
  683.         //({Type:"Sword ", Level:"64", Value:"125000000", Damage:"847", 'Min. Str':"28", 'Equip Bonus':"none"})
  684.         var num1 = /-?\d+/.exec(el.value)[0];
  685.         log("item id is: " + num1, 5);
  686.         var item = getItemInfos(num1);
  687.         log(item.toSource(), 5);
  688.         if (item.Name == text && item.Level < getCurlevel() && item.Value > 0) sellItemInTown(text);
  689.     }
  690.     //else if (/Guardian's|of speed|of life|of power|of regeneration/.test(text)) sellItemInTown(text);
  691.     //else if (/key|orb/.test(text)) sellItemInTown(text);
  692.     //else addToQueue(["tryClickButton('Close')",exploreCommand]);
  693. }
  694.  
  695. function requestItemInfos(itemId)
  696. {
  697.     var req = new XMLHttpRequest();
  698.     req.open("GET", "/dream/itemfloat?item=" + itemId, false);
  699.     req.send();
  700.     return req;
  701. }
  702.  
  703. function getItemInfos(itemId)
  704. {
  705.     var req = requestItemInfos(itemId);
  706.     var el = stringToHTML("<div>" + req.responseText + "</div>");
  707.     var attrs = Array.map($xa(".//td[(not(@colspan) or @colspan='2') and span]|.//td[@colspan='4']/span", 7, el), function (el)
  708.     {
  709.         return el.textContent.replace(/\s+/gm, " ").trim();
  710.     });
  711.     attrs.unshift("Name");
  712.     var result = new Object();
  713.     for (var num1 = 0; num1 < attrs.length; num1 = num1 + 2)
  714.     {
  715.         result[attrs[num1]] = attrs[num1 + 1];
  716.     }
  717.     return result;
  718. }
  719.  
  720. function enchantAccessory()
  721. {
  722.     return enchantItem("accessory");
  723. }
  724.  
  725. function enchantWeapon()
  726. {
  727.     return enchantItem("weapon");
  728. }
  729.  
  730. function enchantArmor()
  731. {
  732.     return enchantItem("armor");
  733. }
  734.  
  735. function enchantItem(item)
  736. {
  737.     var el = $x1("//div[@id='enhance-id']//div[contains(@onclick,'" + item + "')]");
  738.     if (el) clickElement(el);
  739.     return el;
  740. }
  741.  
  742. function openInventoryAndUseItem(item, addCommands)
  743. {
  744.     log("Open inventory and use item: " + item);
  745.     var queue = ["clickButton('Inventory')", "useInventoryItem(\"" + item + "\")"];
  746.     if (addCommands) queue = queue.concat(addCommands);
  747.     queue.push("clickButton('Close',1)");
  748.     return addToQueue(queue, false, true);
  749. }
  750. function openInventoryAndUseItemMS(item, addCommands)
  751. {
  752.     log("Open inventory and use item: " + item);
  753.     var queue = ["clickButton('Inventory')", "useInventoryItemMS(\"" + item + "\")"];
  754.     //opens the inventory which works but then the seccond in the queue useInventoryItemMS() doesnt work
  755.     if (addCommands) queue = queue.concat(addCommands);
  756.     queue.push("clickButton('Close',1)");
  757.     return addToQueue(queue, false, true);
  758. }
  759.  
  760. function searchForMoney()
  761. {
  762.     if (isLoading()) return;
  763.     exploreCommand = "clickExploreOrWait(5)";
  764.     fightCommand = "fightWithNormalAttack()";
  765.     setPuzzleSolverEnabled(puzzleSolverEnabled);
  766.     if (!executeCommandsInQueue())
  767.     {
  768.         var queue = null;
  769.         if ($inc1("dailychest")) openDailyFreeChest();
  770.         else if ($inc1("reviewdiv")) queue = ["clickPlayNow()"];
  771.         else if ($inc1("townsign")) queue = ["goToDungeon()", exploreCommand];
  772.         else if ($inc1("enctext"))
  773.         {
  774.             var mob = $inc1("mobname");
  775.             log("Special encounter: " + mob.textContent, 5);
  776.             switch (mob.textContent)
  777.             {
  778.             case "A Beggar":
  779.                 queue = ["getItemOtNothing()", "getBeggarResultAndSellItem()", exploreCommand]; //
  780.                 break;
  781.             case "A Puzzle Box":
  782.                 queue = ["clickButton('Open')", "solvePuzzleBox()", exploreCommand];
  783.                 break;
  784.             case "A Treasure Chest":
  785.                 queue = ["clickButton('Open')", "solveTreasureChest()", exploreCommand];
  786.                 break;
  787.             case "A Treasure Map":
  788.                 queue = ["clickButton('Find')", "getTreasureMapResult()", exploreCommand];
  789.                 break;
  790.                 // case "Girl in Red":
  791.                 // queue=["clickButton('Accept')","getGirlInRedQuest()",exploreCommand];
  792.                 // break;
  793.                 // case "Guardian of Dreams":
  794.                 // queue=["clickButton('Fight')","fightWithSkill(-1)",exploreCommand];
  795.                 // break;
  796.             case "Magic Mushrooms":
  797.                 queue = ["clickButton('Taste')", "getMagicMushroomResult()", exploreCommand];
  798.                 break;
  799.                 // case "Santa":
  800.                 // queue=["clickButton('Ask for gift')","getSantaResultAndDisposeItem()",exploreCommand];
  801.                 // break;
  802.             case "Wishing Well":
  803.                 queue = ["clickButton('Dive In')", "getWishingWellResultStatistics()", exploreCommand]; //clickButton('Dive In')
  804.                 break;
  805.             default:
  806.                 log("default");
  807.                 queue = [exploreCommand];
  808.                 break;
  809.             }
  810.         }
  811.         else if ($inc1("mobnamespan")) queue = ["goToTown()"];
  812.         else
  813.         {
  814.             log("Unknown situation, waiting...");
  815.             queue = ["emptyTurn()"];
  816.         }
  817.  
  818.         addToQueue(queue);
  819.     }
  820. }
  821.  
  822. function goToDungeon()
  823. {
  824.     var result = getButtons("Auto Explore").length != 0;
  825.     if (!result) clickButton('dungeon');
  826.     return result;
  827. }
  828.  
  829. function goToTown()
  830. {
  831.     var result = $inc1("townsign");
  832.     if (!result)
  833.     {
  834.         clickButton('Town Map');
  835.         clickButton('Okay');
  836.     }
  837.     return result;
  838. }
  839.  
  840. function sellItemInTown(item)
  841. {
  842.     log("Sell Item In Town: " + item, 5);
  843.     addToQueue(["goToTown()", "clickButton('healer')", "sellInventoryItem(\"" + item + "\")", "clickButton('Okay')", "clickButton('Back to Town')", "goToDungeon()"], true, true)
  844. }
  845.  
  846. function getBeggarResultAndSellItem()
  847. {
  848.     var result = getBeggarResult();
  849.     if (result && result.length > 1) sellItemInTown(result[2].replace("!", "").trim());
  850.     return result;
  851. }
  852.  
  853. function searchForPills()
  854. {
  855.     exploreCommand = "clickExploreOrWait()";
  856.     fightCommand = "fightWithNormalAttack()";
  857.     setPuzzleSolverEnabled(puzzleSolverEnabled);
  858.     if (!executeCommandsInQueue())
  859.     {
  860.         var queue = null;
  861.         if ($inc1("reviewdiv")) queue = ["clickPlayNow()"];
  862.         else if ($inc1("townsign")) queue = ["clickButton('Robot Factory')", "emptyTurn()", exploreCommand];
  863.         else if ($inc1("enctext"))
  864.         {
  865.             var mob = $inc1("mobname");
  866.             log("Special encounter: " + mob.textContent, 5);
  867.             switch (mob.textContent)
  868.             {
  869.             case "A Beggar":
  870.                 queue = ["giveCoinsToBeggar(" + getLowCoins() + ")", "getBeggarResult()", exploreCommand];
  871.                 break;
  872.             case "A Puzzle Box":
  873.                 queue = ["clickButton('Open')", "solvePuzzleBox()", exploreCommand];
  874.                 break;
  875.             case "A Treasure Chest":
  876.                 queue = ["clickButton('Open')", "solveTreasureChest()", exploreCommand];
  877.                 break;
  878.             case "A Treasure Map":
  879.                 queue = ["clickButton('Find')", "getTreasureMapResult()", exploreCommand];
  880.                 break;
  881.             case "Girl in Red":
  882.                 queue = ["clickButton('Accept')", "getGirlInRedQuest()", exploreCommand];
  883.                 break;
  884.                 // case "Guardian of Dreams":
  885.                 // queue=["clickButton('Fight')","fightWithSkill(-1)",exploreCommand];
  886.                 // break;
  887.             case "Magic Mushrooms":
  888.                 queue = ["clickButton('Taste')", "getMagicMushroomResult()", exploreCommand];
  889.                 break;
  890.             case "Wishing Well":
  891.                 queue = ["throwCoinsInWell(" + getLowCoins() + ")", "getWishingWellResultStatistics()", exploreCommand];
  892.                 break;
  893.             default:
  894.                 log("default");
  895.                 queue = [exploreCommand];
  896.                 break;
  897.             }
  898.         }
  899.         else if ($inc1("mobnamespan")) queue = ["goToTown()"];
  900.         else
  901.         {
  902.             log("Unknown situation, waiting...");
  903.             queue = ["emptyTurn()"];
  904.         }
  905.  
  906.         addToQueue(queue);
  907.     }
  908. }
  909.  
  910. function solveTreasureChest()
  911. {
  912.     log("solveTreasureChest");
  913.     var result = getTreasureChestResult();
  914.     log(result);
  915.     if (!result)
  916.     {
  917.         var text = $inc1("qnsbox").textContent;
  918.         log(text);
  919.         var match = /My age (will) be (\d+) in (\d+) years\. How young am I now\?/.exec(text) || /My (current) age is (\d+), how young will I be in (\d+) years\?/.exec(text) || /I (have) (\d+) gallons of \w+\.  How many (\d+) gallon containers can I fully fill\?/.exec(text) || /On a (farm) there are ([\w-]+) and ([\w-]+)\. There are total of (\d+) heads and (\d+) legs.  How many ([\w-]+) are on the farm\?/.exec(text);
  920.         log(match);
  921.         if (match)
  922.         {
  923.             switch (match[1])
  924.             {
  925.             case "will":
  926.                 result = parseInt(match[2]) - parseInt(match[3]);
  927.                 break;
  928.             case "current":
  929.                 result = parseInt(match[2]) + parseInt(match[3]);
  930.                 break;
  931.             case "have":
  932.                 result = Math.floor(parseInt(match[2]) / parseInt(match[3]));
  933.                 break;
  934.             case "farm":
  935.                 var alegs = new Array(2);
  936.                 for (var num1 = 0; num1 < 2; num1++)
  937.                 {
  938.                     var text = match[2 + num1];
  939.                     alegs[num1] = text == "chickens" ? 2 : text == "three-legged-cows" ? 3 : text == "horses" ? 4 : 0;
  940.                 }
  941.                 var heads = parseInt(match[4]);
  942.                 var legs = parseInt(match[5]);
  943.                 log("X+Y=" + heads + "; " + alegs[0] + "X+" + alegs[1] + "Y=" + legs);
  944.                 result = match[6] == match[2] ? (legs - alegs[1] * heads) / (alegs[0] - alegs[1]) : (legs - alegs[0] * heads) / (alegs[1] - alegs[0]);
  945.                 break;
  946.             }
  947.             log(result);
  948.             if (result)
  949.             {
  950.                 $inc1("answer").value = result;
  951.                 clickButton("Open");
  952.             }
  953.         }
  954.     }
  955.     return result;
  956. }
  957.  
  958. function resetQueueFailedRepeatedCommand()
  959. {
  960.     log("reseting queue failed and repeated state");
  961.     var state = getState();
  962.     state.failedCommand = 0;
  963.     state.repeatedCommand = 0;
  964.     setData();
  965. }
  966.  
  967. function solvePuzzleBox()
  968. {
  969.     log("solvePuzzleBox");
  970.     var result = getPuzzleBoxResultStatistics();
  971.     log(result);
  972.     if (!result)
  973.     {
  974.         result = getPuzzleBoxType();
  975.         log(result);
  976.         if (result)
  977.         {
  978.             log(result[1]);
  979.             result = /buttons/.test(result[1]) ? solveGreenButtonsPuzzle() : /colors/.test(result[1]) ? solveFourColorsPuzzle() : null;
  980.             log(result);
  981.             if (result)
  982.             {
  983.                 resetQueueFailedRepeatedCommand();
  984.                 result = null;
  985.             }
  986.         }
  987.     }
  988.     return result;
  989. }
  990.  
  991. function solveGreenButtonsPuzzle()
  992. {
  993.     log("solveGreenButtonsPuzzle");
  994.     var key = "";
  995.     var xpath = $x("//div[@class='qnsbox']/table//table//td//a", 7);
  996.     log(xpath.snapshotLength);
  997.     for (var num1 = 0; num1 < xpath.snapshotLength; num1++)
  998.     {
  999.         var el = xpath.snapshotItem(num1);
  1000.         key += el.parentNode.textContent;
  1001.     }
  1002.     log(key);
  1003.     var solutions = greenButtonsCombinations[key.toString()];
  1004.     log(solutions);
  1005.     if (!solutions) promptDebug("greenButtonsCombinations[" + key + "]");
  1006.     for (var num1 = 0; num1 < solutions.length; num1++)
  1007.     {
  1008.         var solution = solutions[num1];
  1009.         log(solution);
  1010.         for (var num2 = 0; num2 < solution.length; num2++)
  1011.         {
  1012.             if (solution[num2])
  1013.             {
  1014.                 var el = xpath.snapshotItem(num2);
  1015.                 var src = el.getElementsByTagName("img")[0].src;
  1016.                 var isToPress = /db_button/.test(src);
  1017.                 var isRight = /lg_button/.test(src);
  1018.                 var isWrong = /lr_button/.test(src);
  1019.                 log(isToPress + " " + isRight + " " + isWrong);
  1020.                 if (isToPress) return clickElement(el);
  1021.                 else if (isWrong) break;
  1022.             }
  1023.         }
  1024.     }
  1025.     return false;
  1026. }
  1027.  
  1028. function solveFourColorsPuzzle()
  1029. {
  1030.     log("solveFourColorsPuzzle");
  1031.     var solution = fourColorsCombinations;
  1032.     var xpath = $x("//div[@id='resl']//input[@class='dungeoninput']", 7);
  1033.     log(xpath.snapshotLength);
  1034.     for (var num1 = 0; num1 < xpath.snapshotLength; num1 += 2)
  1035.     {
  1036.         var cp = xpath.snapshotItem(num1).value + xpath.snapshotItem(num1 + 1).value;
  1037.         log(cp);
  1038.         solution = solution[cp];
  1039.     }
  1040.     log(solution.key);
  1041.     xpath = document.evaluate("//div[@class='qnsbox']/table//table//td//a", document, null, 7, null);
  1042.     log(xpath.snapshotLength);
  1043.     for (var num1 = 0; num1 < solution.key.length; num1++)
  1044.     {
  1045.         var num2 = solution.key[num1];
  1046.         log(num1 + " " + num2);
  1047.         var el = xpath.snapshotItem(num1 + num2 * 4);
  1048.         clickElement(el);
  1049.     }
  1050.     return clickButton("Open");
  1051. }
  1052.  
  1053. function fightWithNormalAttack()
  1054. {
  1055.     var result = getFightResult();
  1056.     if (!result && clickButton("Attack")) resetQueueFailedRepeatedCommand();
  1057.     return result;
  1058. }
  1059.  
  1060. function fightWithSkill(index)
  1061. {
  1062.     var result = getFightResult();
  1063.     if (!result && useSkill(index)) resetQueueFailedRepeatedCommand();
  1064.     return result;
  1065. }
  1066.  
  1067. var gun = "BB gun";
  1068. var sword = null;
  1069. var wand = "wooden stick";
  1070.  
  1071. function equipGun()
  1072. {
  1073.     return equipWeapon(gun);
  1074. }
  1075.  
  1076. function equipSword()
  1077. {
  1078.     return equipWeapon(sword);
  1079. }
  1080.  
  1081. function equipWand()
  1082. {
  1083.     return equipWeapon(wand);
  1084. }
  1085.  
  1086. function equipWeapon(weapon)
  1087. {
  1088.     return getCurrentWeapon().textContent == weapon ? true : useQuickInventoryItem(weapon);
  1089. }
  1090.  
  1091. function refillSkillPoints()
  1092. {
  1093.     return getCursp() < 20 ? openInventoryAndUseItem("fairy dust") : false;
  1094. }
  1095. function refillSkillPointsMS()
  1096. {
  1097.     return getCursp() < 20 ? openInventoryAndUseItemMS("fairy dust") : false;
  1098.     //does the same as last function just to double check if it actualy is below 20 then uses "fairy dust" to refill the skill points function openInventoryAndUseItemMS(item, addCommands)
  1099. }
  1100.  
  1101. function getQuickInventoryItem(item)
  1102. {
  1103.     return $x1("//div[@id='invbox']//td[a/text()=\"" + item + "\"]");
  1104. }
  1105.  
  1106. function getQuickIventoryItemId(item)
  1107. {
  1108.     /'(\d+)'/.exec($x1(".//a/@onmouseover", getQuickInventoryItem(item)).value)[1];
  1109. }
  1110.  
  1111. function useQuickInventoryItem(item)
  1112. {
  1113.     var el = getQuickInventoryItem(item);
  1114.     if (!el) log("item " + item + " not found.");
  1115.     else
  1116.     {
  1117.         el = el.getElementsByTagName("div")[0];
  1118.         log(el.textContent + " item '" + item + "'");
  1119.         clickElement(el);
  1120.     }
  1121.     return el;
  1122. }
  1123.  
  1124. function useInventoryItem(item)
  1125. {
  1126.     var el = $x1("//table[@id='tinvtb']//tr[td/a/text()=\"" + item + "\"]//div");
  1127.     if (!el) log("item " + item + " not found.");
  1128.     else
  1129.     {
  1130.         log(el.textContent + " item '" + item + "'");
  1131.         clickElement(el);
  1132.     }
  1133.     return el;
  1134. }
  1135.  
  1136. function useInventoryItemMS(item)
  1137. {
  1138.     var el = $x1("//table[@id='tinvtb']//tr[td/a/text()=\"" + item + "\"]//div");
  1139.     return getCursp() < 20 ? refillSkillPoints() : fightWithSkill(skill)
  1140.     if (!el) // if el is false (it seems that the previous check makes it stick then force reload() which makes a continuous loop
  1141.     {
  1142.         log("item " + item + " not found."); // log not found
  1143.         queue = [null]; // clear the queue so that it clears the current task getting the skill point refill
  1144.         queue = ["goToTown()", "emptyTurn()", "clickButton('Oceana Hospital')", "emptyTurn()","clickButton('Buy', 1)", "emptyTurn()"];
  1145.         //go to town, wait, click the button, wait, buy the item needed then recheck
  1146.         return getCursp() < 20 ? refillSkillPoints() : fightWithSkill(skill)
  1147.        
  1148.     }
  1149.     else
  1150.     {
  1151.         log(el.textContent + " item '" + item + "'");
  1152.         clickElement(el);
  1153.     }
  1154.     return el;
  1155. }
  1156.  
  1157. function sellInventoryItem(item)
  1158. {
  1159.     var el = $x1("//div[@id='invbox']//td[a/text()=\"" + item + "\"]//span");
  1160.     if (!el) log("item " + item + " not found.");
  1161.     else
  1162.     {
  1163.         log(el.textContent + " item '" + item + "'");
  1164.         clickElement(el);
  1165.     }
  1166.     return el;
  1167. }
  1168.  
  1169. function disableAutoFight()
  1170. {
  1171.     var el = getDisableauto();
  1172.     if (el && !el.checked) clickElement(el);
  1173. }
  1174.  
  1175. function aim()
  1176. {
  1177.     return useGunSkill("Aim");
  1178. }
  1179.  
  1180. function guard()
  1181. {
  1182.     return useSwordSkill("Guard");
  1183. }
  1184.  
  1185. function greaterHeal()
  1186. {
  1187.     return useWandSkill("Greater Heal");
  1188. }
  1189.  
  1190. function heal()
  1191. {
  1192.     return useWandSkill("Heal");
  1193. }
  1194.  
  1195. function lightHeal()
  1196. {
  1197.     return useWandSkill("Light Heal");
  1198. }
  1199.  
  1200. function shield()
  1201. {
  1202.     return useWandSkill("Shield");
  1203. }
  1204.  
  1205. function useGunSkill(skill)
  1206. {
  1207.     return equipGun() ? useSkill(skill) : true;
  1208. }
  1209.  
  1210. function useSwordSkill(skill)
  1211. {
  1212.     return equipSword() ? useSkill(skill) : true;
  1213. }
  1214.  
  1215. function useWandSkill(skill)
  1216. {
  1217.     return equipWand() ? useSkill(skill) : true;
  1218. }
  1219.  
  1220. function useSkill(skill)
  1221. {
  1222.     //log("useSkill");
  1223.     var flag = false;
  1224.     if (typeof (skill) == "number") skill = $x1("//tr[@class='vskill'][" + (skill < 0 ? "last()" : (skill + 1)) + "]");
  1225.     else if (typeof (skill) == "string") skill = $x1("//tr[@class='vskill' and td/text()=\" " + skill + "\"]");
  1226.     //log(skill);
  1227.     if (skill)
  1228.     {
  1229.         clickElement(skill);
  1230.         //clickButton("Use Skill");
  1231.         var bar = $inc1("powerbar");
  1232.         //log(bar);
  1233.         var pro = $inc1("powerbarwidth");
  1234.  
  1235.         var c = document.getElementById("skbt");
  1236.         var b = document.getElementById("powerbar");
  1237.         c.style.display = "none";
  1238.         b.style.display = "inline-block";
  1239.  
  1240.         pro.style.width = "100%";
  1241.         a = randomFromTo(95,100);
  1242.         document.getElementById("powerbarwidth").style.width = a + "%";
  1243.  
  1244.         //log(pro);
  1245.         flag = clickElement(bar);
  1246.     }
  1247.     return flag;
  1248. }
  1249.  
  1250. function randomFromTo(from, to)
  1251. {
  1252.     return Math.floor(Math.random() * (to - from + 1) + from);
  1253. }
  1254.  
  1255. function chainMoneyWells()
  1256. {
  1257.     setPuzzleSolverEnabled(puzzleSolverEnabled);
  1258.     if (!executeCommandsInQueue())
  1259.     {
  1260.         var queue = null;
  1261.         var state = getState();
  1262.         //log("worink on state: "+state.action);
  1263.         switch (state.action)
  1264.         {
  1265.         case "createPlayer":
  1266.             createPlayer(playerType, playerName);
  1267.             break;
  1268.         case "followTutorial":
  1269.             followTutorial();
  1270.             break;
  1271.         case "maxMoney":
  1272.             maxMoney();
  1273.             break;
  1274.         case "betAllOnWishingWells":
  1275.             betAllOnWishingWells(chainWihsingWells);
  1276.             break;
  1277.         case "end":
  1278.             break;
  1279.         default:
  1280.             changeStateAction('createPlayer');
  1281.             break;
  1282.         }
  1283.         addToQueue(queue);
  1284.     }
  1285. }
  1286.  
  1287. function emptyTurn()
  1288. {
  1289.     return true;
  1290. }
  1291.  
  1292. function changeStateAction(newAction)
  1293. {
  1294.     if (newAction)
  1295.     {
  1296.         log("new action: " + newAction);
  1297.         getState().action = newAction;
  1298.         setData();
  1299.     }
  1300.     return newAction;
  1301. }
  1302.  
  1303. function restart()
  1304. {
  1305.     if (getCurlevel() > 3) log("don't reset character, level is higher than 3");
  1306.     else if (getCurcoins() > 20000) log("don't reset character, more than 20000 coins");
  1307.     else
  1308.     {
  1309.         log("restart character");
  1310.         changeStateAction("createPlayer");
  1311.         var state = getState()
  1312.         var stat = getStatistics();
  1313.         stat.restarts++;
  1314.         stat.moneyWellsHistory.push(state.moneyWells + "/" + state.WishingWells);
  1315.         getData().state = null;
  1316.         return addToQueue(["clickButton('Character')", "clickRestart()", "clickButton('Okay')"], true);
  1317.     }
  1318. }
  1319.  
  1320. function createPlayer(classIndex, playerName)
  1321. {
  1322.     var classes = $nc("createboxsel");
  1323.     if (!classes) restart();
  1324.     else
  1325.     {
  1326.         var state = getState();
  1327.         state.WishingWells = 0;
  1328.         state.moneyWells = 0;
  1329.         state.solvedPuzzle = 0;
  1330.         clickElement(classes[classIndex]);
  1331.         var name = $inc1("name");
  1332.         name.value = playerName;
  1333.         clickPlayNow();
  1334.         changeStateAction('followTutorial')
  1335.     }
  1336. }
  1337.  
  1338. function followTutorial()
  1339. {
  1340.     var result = $inc1("tutorialdiv") != null;
  1341.     if (result) addToQueue(["clickButton('Village Chief')", "clickButton('Back to Town')", "clickButton('The Marsh')", "emptyTurn()", "clickExplore()", "emptyTurn()", "clickButton('Taste')", "reload()", "changeStateAction('maxMoney')"]); //,"clickExplore()","attack()","clickExplore()","clickButton('Town Map')"
  1342. }
  1343.  
  1344. function maxMoney()
  1345. {
  1346.     return addToQueue(["clickButton('Home')", "tryClickButton('Open')", "emptyTurn()", "tryClickButton('Close')", "clickPlayNow()", "clickButton('Guardian')", "emptyTurn()", "buyMoney()", "clickButton('Close')", "changeStateAction('betAllOnWishingWells')"]);
  1347. }
  1348.  
  1349. function betAllOnWishingWells(moneyWells)
  1350. {
  1351.     var ceowor = "clickExploreOrWaitOrReset()";
  1352.     var queue = null;
  1353.     var state = getState();
  1354.     if ($inc1("reviewdiv")) queue = ["clickPlayNow()"];
  1355.     else if ($inc1("townsign")) queue = ["clickButton('The Marsh')", "emptyTurn()", ceowor];
  1356.     else if ($inc1("enctext"))
  1357.     {
  1358.         var mob = $inc1("mobname");
  1359.         log("Special encounter: " + mob.textContent);
  1360.         switch (mob.textContent)
  1361.         {
  1362.         case "A Puzzle Box":
  1363.             queue = state.solvedPuzzle > 2 ? [ceowor, "clickButton('Okay')"] : ["clickButton('Open')", "solvePuzzleBox()", ceowor];
  1364.             break;
  1365.         case "Girl in Red":
  1366.             queue = ["clickButton('Accept')", "getGirlInRedQuest()", ceow];
  1367.             break;
  1368.         case "Magic Mushrooms":
  1369.             queue = ["clickButton('Taste')", "getMagicMushroomResult()", ceowor];
  1370.             break;
  1371.         case "Wishing Well":
  1372.             queue = ["throwCoinsInWell(" + getCurcoins() + ")", "getWishingWellResultAndContinueOrReset(" + moneyWells + ")", ceowor];
  1373.             break;
  1374.         default:
  1375.             queue = [ceowor];
  1376.             break;
  1377.         }
  1378.     }
  1379.     else if ($inc1("mobname")) queue = ["clickButton('Town Map')", "clickButton('Okay')"];
  1380.     else queue = [ceowor];
  1381.     addToQueue(queue);
  1382.     setData();
  1383. }
  1384.  
  1385. function buyMoney()
  1386. {
  1387.     var flag = getCurhgems() < 10;
  1388.     if (!flag) clickButton('Buy');
  1389.     return flag;
  1390. }
  1391.  
  1392. function clickExploreOrWaitOrReset(index)
  1393. {
  1394.     if (getCurenergy() == 0 && getState().moneyWells < 3) return restart();
  1395.     return clickExploreOrWait(index, 4);
  1396. }
  1397.  
  1398. function getWishingWellResultAndContinueOrReset(moneyWells)
  1399. {
  1400.     var match = getWishingWellResultStatistics();
  1401.     log(match);
  1402.     if (match)
  1403.     {
  1404.         var state = getState();
  1405.         state.WishingWells++;
  1406.         if (getCurcoins() == 0) restart();
  1407.         else
  1408.         {
  1409.             state.moneyWells++;
  1410.             if (state.moneyWells == moneyWells) addToQueue(["changeStateAction('end')"]);
  1411.         }
  1412.         setData();
  1413.     }
  1414.     return match;
  1415. }
  1416.  
  1417. function getPuzzleBoxResultStatistics()
  1418. {
  1419.     log("solvePuzzleBox");
  1420.     var match = getPuzzleBoxResult();
  1421.     log(match);
  1422.     if (match)
  1423.     {
  1424.         var text = match[1];
  1425.         getState().solvedPuzzle++;
  1426.         var stat = getStatistics();
  1427.         stat.puzzleBoxes++;
  1428.         if (/\d+ coins/.test(text))
  1429.         {
  1430.             log("Box contains coins");
  1431.             stat.moneyPuzzleBoxes++;
  1432.         }
  1433.         else if (/A magical Dexterity Pill/.test(text))
  1434.         {
  1435.             log("Box contains Dexterity Pill");
  1436.             stat.dexterityPuzzleBoxes++;
  1437.         }
  1438.         else if (/A magical Speed Pill/.test(text))
  1439.         {
  1440.             log("Box contains Speed Pill");
  1441.             stat.speedPuzzleBoxes++;
  1442.         }
  1443.         else if (/A magical IQ Pill/.test(text))
  1444.         {
  1445.             log("Box contains IQ Pill");
  1446.             stat.iqPuzzleBoxes++;
  1447.         }
  1448.         setData();
  1449.     }
  1450.     return match;
  1451. }
  1452.  
  1453. function getWishingWellResultStatistics()
  1454. {
  1455.     var match = getWishingWellResult();
  1456.     log(match);
  1457.     if (match)
  1458.     {
  1459.         var stat = getStatistics();
  1460.         stat.WishingWells++;
  1461.         var text = match[1];
  1462.         log(text);
  1463.         if (/The well suddenly spits out twice much coins as you threw in!/.test(text))
  1464.         {
  1465.             stat.moneyWells++;
  1466.             log("gained money");
  1467.         }
  1468.         else if (/The well invites you to take drink its water!/.test(text))
  1469.         {
  1470.             stat.skillWells++;
  1471.             log("skill refilled");
  1472.         }
  1473.         else if (/The well sprays some water on you/.test(text))
  1474.         {
  1475.             stat.energyWells++;
  1476.             log("energy refilled");
  1477.         }
  1478.         setData();
  1479.     }
  1480.     return match;
  1481. }
  1482.  
  1483. function throwCoinsInWell(coins)
  1484. {
  1485.     return submitCoins(coins, "Throw");
  1486. }
  1487.  
  1488. function giveCoinsToBeggar(coins)
  1489. {
  1490.     return submitCoins(coins, "Give");
  1491. }
  1492.  
  1493. function submitCoins(coins, button)
  1494. {
  1495.     //log("submit coins "+coins,5);
  1496.     var amount = $inc1("amount");
  1497.     if (amount) amount.value = coins;
  1498.     return amount && clickButton(button);
  1499. }
  1500.  
  1501. //                  0                              10                                       20                                                30                                                       40                                                            50                                                                    60                                                                      70        
  1502. var gcdSharedCoins = [0, 20, 30, 40, 50, 60, 72, 98, 128, 162, 200, 240, 288, 345, 414, 496, 595, 714, 856, 1027, 1232, 1453, 1714, 2022, 2385, 2814, 3320, 3917, 4622, 5453, 6434, 7592, 8958, 10570, 12472, 14716, 17364, 20489, 24177, 28528, 33663, 39049, 45296, 52543, 60949, 70700, 82012, 95133, 110354, 123596, 138427, 155038, 173642, 194479, 217816, 243953, 273227, 306014, 342735, 383863, 429926, 481517, 539299, 604014, 676495, 757674, 848594, 950425, 1064476, 1192213, 1335278];
  1503.  
  1504. function getGCDSharedCoinsCurrentLevel()
  1505. {
  1506.     return gcdSharedCoins[getCurlevel()] * bonusFactor;
  1507. }
  1508.  
  1509. function getLowCoins()
  1510. {
  1511.     return getGCDSharedCoinsCurrentLevel() * 2 + 1;
  1512. }
  1513.  
  1514. function getHighCoins()
  1515. {
  1516.     return getGCDSharedCoinsCurrentLevel() * 4 + 1;
  1517. }
  1518.  
  1519. function getDisableauto()
  1520. {
  1521.     return $inc1("disableauto");
  1522. }
  1523.  
  1524. function getCursp()
  1525. {
  1526.     return getNumericValue("cursp");
  1527. }
  1528.  
  1529. function getMobHp()
  1530. {
  1531.     return getNumericValue("mobhp");
  1532. }
  1533.  
  1534. function getCurhp()
  1535. {
  1536.     return getNumericValue("curhp");
  1537. }
  1538.  
  1539. function getCurhgems()
  1540. {
  1541.     return getNumericValue("curhgems");
  1542. }
  1543.  
  1544. function getCurlevel()
  1545. {
  1546.     return getNumericValue("curlevel");
  1547. }
  1548.  
  1549. function getCurcoins()
  1550. {
  1551.     return getNumericValue("curcoins");
  1552. }
  1553.  
  1554. function getCurenergy()
  1555. {
  1556.     return getNumericValue("curenergy");
  1557. }
  1558.  
  1559. function getCurmaxenergy()
  1560. {
  1561.     return getNumericValue("curmaxenergy");
  1562. }
  1563.  
  1564. function getCurrentWeapon()
  1565. {
  1566.     return $x1("//div[@id='equipbox']//tr[td/img/@alt='weapon']/td/a");
  1567. }
  1568.  
  1569. function getHpPercent()
  1570. {
  1571.     return getNumericValue("hpwidth", 100, function (el)
  1572.     {
  1573.         return el.style.width;
  1574.     });
  1575. }
  1576.  
  1577. function getMobHpPercent()
  1578. {
  1579.     return getNumericValue("mobhpwidth", 100, function (el)
  1580.     {
  1581.         return el.style.width;
  1582.     });
  1583. }
  1584.  
  1585. function getNumericValue(idname, defaultValue, selector)
  1586. {
  1587.     var num1 = defaultValue || 0;
  1588.     var el = $inc1(idname);
  1589.     //log(element+": "+el);
  1590.     if (el)
  1591.     {
  1592.         num1 = parseInt((selector ? selector(el) : el.textContent).replace(/,/gm, ""));
  1593.         //log("element value "+num1);
  1594.     }
  1595.     return num1;
  1596. }
  1597.  
  1598. function addToQueue(commands, keepCurrentQueue, ontop)
  1599. {
  1600.     //log(commands);
  1601.     if (commands)
  1602.     {
  1603.         var queue = getQueue();
  1604.         if (keepCurrentQueue)
  1605.         {
  1606.             if (ontop) commands = commands.concat(queue);
  1607.             else commands = queue.concat(commands);
  1608.         }
  1609.         queue.clear();
  1610.         for (var num1 = 0; num1 < commands.length; num1++) queue.push(commands[num1]);
  1611.         //log("actual queue:"+queue);
  1612.         setData();
  1613.     }
  1614.     return commands;
  1615. }
  1616.  
  1617. function executeCommandsInQueue()
  1618. {
  1619.     log("executeCommandsInQueue");
  1620.     var queue = getQueue();
  1621.     var flag = queue.length != 0;
  1622.     if (flag)
  1623.     {
  1624.         var state = getState();
  1625.         var command = queue.shift();
  1626.         setInfo("Executing: " + command + " (" + state.failedCommand + "," + state.repeatedCommand + ")");
  1627.  
  1628.         var result = null;
  1629.         try
  1630.         {
  1631.             result = eval(command);
  1632.         }
  1633.         catch (ex)
  1634.         {
  1635.             log(command + "\n" + ex.message + "\n" + ex.stack);
  1636.         }
  1637.         log("Result of '" + command + "' is " + result);
  1638.         if (result != null)
  1639.         {
  1640.             state.failedCommand = 0;
  1641.         }
  1642.         else
  1643.         {
  1644.             queue.unshift(command);
  1645.             var fails = state.failedCommand++;
  1646.             if (fails > 5)
  1647.             {
  1648.                 if ($inc1("debug").checked) promptDebug(command);
  1649.                 else
  1650.                 {
  1651.                     log("failedCommand detected desynchronization ... trying to reset");
  1652.                     addToQueue(["reload()"]);
  1653.                 }
  1654.             }
  1655.         }
  1656.  
  1657.         if (command != state.lastCommand)
  1658.         {
  1659.             state.repeatedCommand = 0;
  1660.             state.lastCommand = command;
  1661.         }
  1662.         else
  1663.         {
  1664.             var repeated = state.repeatedCommand++;
  1665.             if (repeated > 5)
  1666.             {
  1667.                 if ($inc1("debug").checked) promptDebug(command);
  1668.                 else
  1669.                 {
  1670.                     log("repeatedCommand detected desynchronization ... trying to reset");
  1671.                     addToQueue(["reload()"]);
  1672.                 }
  1673.             }
  1674.         }
  1675.  
  1676.         setData();
  1677.     }
  1678.     return flag;
  1679. }
  1680.  
  1681. function reload()
  1682. {
  1683.     log("reload");
  1684.     var href = getData().entryPoint;
  1685.     var state = getState();
  1686.     state.failedcommand = 0;
  1687.     state.repeatedcommand = 0;
  1688.     setData();
  1689.     if (location.href == href) location.reload(true);
  1690.     else location.href = href;
  1691.     return true;
  1692. }
  1693.  
  1694. function getMessageBoxContent(removeNewLines)
  1695. {
  1696.     var div = $inc1("exploreActionResult") || $inc1("battletextmiddle") || $inc1("actionresulttd");
  1697.     var text = div ? div.textContent : "";
  1698.     if (removeNewLines) text = text.replace(/\s+/gm, " ");
  1699.     return text.trim();
  1700. }
  1701.  
  1702. function parseMessageBoxContent(regexs, removeNewLines)
  1703. {
  1704.     return parseMessage(regexs, getMessageBoxContent(removeNewLines));
  1705. }
  1706.  
  1707. function getElementContent(element, removeNewLines)
  1708. {
  1709.     var el = $inc1(element);
  1710.     var text = el ? el.textContent : "";
  1711.     if (removeNewLines) text = text.replace(/\s+/gm, " ");
  1712.     return text.trim();
  1713. }
  1714.  
  1715. var lastParsedMessage;
  1716.  
  1717. function parseMessage(regexs, text)
  1718. {
  1719.     var result;
  1720.     for (var num1 = 0; num1 < regexs.length; num1++)
  1721.     {
  1722.         log(regexs[num1] + " = " + regexs[num1].exec(text));
  1723.         if (result = regexs[num1].exec(text)) break;
  1724.     }
  1725.     log(result ? result[0] : text);
  1726.     return (lastParsedMessage = result);
  1727. }
  1728.  
  1729. function getPuzzleBoxType()
  1730. {
  1731.     return parseMessageBoxContent([/The metallic Puzzle Box\s*is locked electronically,(.*)/], true);
  1732. }
  1733.  
  1734. function getFightResult()
  1735. {
  1736.     return parseMessageBoxContent([/You found an(.*)!/, /You received(.*)coins!\s*You received(.*)experience!/, /You received(.*)!/, /You were knocked(.*)/], true);
  1737. }
  1738.  
  1739. function getBeggarResult()
  1740. {
  1741.     return parseMessageBoxContent([/(The Beggar .+?\.)(.*!)?(.*)/], true);
  1742. }
  1743.  
  1744. function getPuzzleBoxResult()
  1745. {
  1746.     return parseMessageBoxContent([/Inside you find:\s*(.*)!/, /Puzzle Box "Self-destructing in 3\.\.2\.\.1\.\."/], true);
  1747. }
  1748.  
  1749. function getTreasureChestResult()
  1750. {
  1751.     return parseMessageBoxContent([/Treasure Chest opens! Inside you find:(.*)!(.*)/, /You tried to bash the Treasure Chest open, but it disappeared before you made impact\./, /Treasure Chest laughs "wrong answer!" and then disappears\./], true);
  1752. }
  1753.  
  1754. function getTreasureMapResult()
  1755. {
  1756.     return parseMessageBoxContent([/You found:(.*)!(.*)/, /You sold the Treasure Map to another adventurer\.(.*)/], true);
  1757. }
  1758.  
  1759. function getMagicMushroomResult()
  1760. {
  1761.     return parseMessageBoxContent([/The mushroom(.*)/], true);
  1762. }
  1763.  
  1764. function getWishingWellResult()
  1765. {
  1766.     return parseMessageBoxContent([/You tossed the coins into the Wishing Well\.\s*(.*)\s*(.*)/, /You dived into the Wishing Well(.+)\s*(.*)\s*(.*)/]);
  1767. }
  1768.  
  1769. function getGirlInRedQuestResult()
  1770. {
  1771.     return parseMessageBoxContent([/Avenge me and defeat (\d*)\s*(.+) and I will repay you for your trouble\./], true);
  1772. }
  1773.  
  1774. function getQuestEndResult()
  1775. {
  1776.     return parseMessageBoxContent([/(.*?)runs to you, gives you a \*hug\* and :(.*?)!/], true);
  1777. }
  1778.  
  1779. function getSantaResult()
  1780. {
  1781.     return parseMessageBoxContent([/Santa opens his gift bag and hands you a(.*)!/], true);
  1782. }
  1783.  
  1784. function getMysteryBoxResult()
  1785. {
  1786.     return parseMessage([/You used a mystery box\. You found "(.*)"/, /You used a mystery box\. You found(.*)!/, /You used a mystery box\. You found(.*)\./], getElementContent("stepupdatenc", true));
  1787. }
  1788.  
  1789. function getGuardianOfDreamsResult()
  1790. {
  1791.     return parseMessageBoxContent([/The Guardian smiles and gives you(.*)!/], true);
  1792. }
  1793.  
  1794. function clickExploreOrWait(index, waitMinutes)
  1795. {
  1796.     var flag = false;
  1797.     if (getCurenergy() != 0) flag = clickExplore(index) || clickButton("Back to Area Map");
  1798.     else
  1799.     {
  1800.         if (!waitMinutes) waitMinutes = (getCurmaxenergy() - 1) * 4;
  1801.         log("pausing minutes: " + waitMinutes);
  1802.         document.getElementByID("info").innerHTML("puasing for: " + waitMinutes + " minutes");
  1803.         mainlooptimeout = waitMinutes * 60 * 1000;
  1804.     }
  1805.     return flag;
  1806. }
  1807.  
  1808. function clickPlayNow()
  1809. {
  1810.     //log("click PlayNow");
  1811.     var btns = $nc("btn");
  1812.     if (btns != null)
  1813.     {
  1814.         for (var num2 = 0; num2 < btns.length; num2++)
  1815.         {
  1816.             var btn = btns[num2];
  1817.             if (btn.alt == "Play Now")
  1818.             {
  1819.                 clickElement(btn);
  1820.                 return btn;
  1821.             }
  1822.         }
  1823.     }
  1824.     return null;
  1825. }
  1826.  
  1827. function clickRestart()
  1828. {
  1829.     //log("click restart");
  1830.     var links = document.links;
  1831.     for (var num1 = 0; num1 < links.length; num1++)
  1832.     {
  1833.         var link = links[num1];
  1834.         if (link.textContent == "restart")
  1835.         {
  1836.             clickElement(link);
  1837.             return link;
  1838.         }
  1839.     }
  1840.     return null;
  1841. }
  1842.  
  1843. function clickExplore(index)
  1844. {
  1845.     return clickButton("Explore", index);
  1846. }
  1847.  
  1848.  
  1849.  
  1850. function tryClickButton(text, index)
  1851. {
  1852.     clickButton(text, index);
  1853.     return true;
  1854. }
  1855.  
  1856. function clickButton(text, index)
  1857. {
  1858.     //log("click "+text);
  1859.     var btns = getButtons(text);
  1860.     if (btns.length != 0)
  1861.     {
  1862.         var btn = btns[Math.max(0, isNaN(index) ? 0 : Math.min(btns.length - 1, index))];
  1863.         clickElement(btn);
  1864.     }
  1865.     return btn;
  1866. }
  1867.  
  1868. function getButtons(text)
  1869. {
  1870.     //log("searching button "+text);
  1871.     var result = new Array();
  1872.     var classes = ["btn100", "btn50", "btn60", "innertab", "menubar", "navbutton", "signtdright", "signtdleft"];
  1873.     for (var num1 = 0; num1 < classes.length; num1++)
  1874.     {
  1875.         var btns = $nc(classes[num1]);
  1876.         //log(btns);
  1877.         if (btns != null)
  1878.         {
  1879.             //log(btns.length);
  1880.             for (var num2 = 0; num2 < btns.length; num2++)
  1881.             {
  1882.                 //log(btns[num2].textContent);
  1883.                 var btn = btns[num2];
  1884.                 var onclick = btn.getAttribute("onclick");
  1885.                 if (btn.textContent.trim() == text || (onclick && onclick.indexOf(text) != -1)) result.push(btn);
  1886.             }
  1887.         }
  1888.     }
  1889.     //if (result.length==0) log("Button not found");
  1890.     return result;
  1891. }
  1892.  
  1893. function clickElement(element)
  1894. {
  1895.     //log("generating click event");
  1896.     if (element)
  1897.     {
  1898.         var evt = document.createEvent("MouseEvents");
  1899.         evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  1900.         element.dispatchEvent(evt);
  1901.     }
  1902.     return element;
  1903. }
  1904.  
  1905. var _data;
  1906.  
  1907. function getData()
  1908. {
  1909.     return _data || (_data = (eval(GM_getValue("data")) || new Object()));
  1910. }
  1911.  
  1912. function setData()
  1913. {
  1914.     //log("Setting data:"+getData().toSource());
  1915.     setTimeout(function ()
  1916.     {
  1917.         GM_setValue("data", getData().toSource());
  1918.     }, 0);
  1919. }
  1920.  
  1921. function getDataKey(key, newKey)
  1922. {
  1923.     var data = getData();
  1924.     var dataKey = data[key];
  1925.     if (!dataKey)
  1926.     {
  1927.         dataKey = data[key] = newKey;
  1928.         setData();
  1929.     }
  1930.     return dataKey;
  1931. }
  1932.  
  1933. function getOptions()
  1934. {
  1935.     return getDataKey("options", {
  1936.         autoplay: false,
  1937.         method: "fight()"
  1938.     });
  1939. }
  1940.  
  1941. function getQueue()
  1942. {
  1943.     return getDataKey("queue", new Array());
  1944. }
  1945.  
  1946. function getState()
  1947. {
  1948.     return getDataKey("state", {
  1949.         moneyWells: 0,
  1950.         WishingWells: 0,
  1951.         failedCommand: 0,
  1952.         repeatedCommand: 0,
  1953.         lastCommand: "",
  1954.         solvedPuzzle: 0
  1955.     });
  1956. }
  1957.  
  1958. function getStatistics()
  1959. {
  1960.     return getDataKey("statistics", {
  1961.         puzzleBoxes: 0,
  1962.         moneyPuzzleBoxes: 0,
  1963.         dexterityPuzzleBoxes: 0,
  1964.         speedPuzzleBoxes: 0,
  1965.         iqPuzzleBoxes: 0,
  1966.         WishingWells: 0,
  1967.         energyWells: 0,
  1968.         moneyWells: 0,
  1969.         skillWells: 0,
  1970.         restarts: 0,
  1971.         moneyWellsHistory: []
  1972.     });
  1973. }
  1974.  
  1975. var greenButtonsCombinations = {
  1976.     "001121122": [[, , , , , 1, 1, 1, 1]],
  1977.     "010112121": [[, , 1, , , , 1, 1, 1]],
  1978.     "010211121": [[1, , , , , , 1, 1, 1]],
  1979.     "010212131": [[, , , , 1, , 1, 1, 1]],
  1980.     "011022112": [[, , 1, , , 1, , 1, 1]],
  1981.     "011112021": [[, , 1, , , 1, 1, , 1]],
  1982.     "011121112": [[, , 1, , , 1, 1, 1, ], [1, , , , , 1, , 1, 1]],
  1983.     "011122122": [[, , , , 1, 1, , 1, 1]],
  1984.     "011211021": [[1, , , , , 1, 1, , 1]],
  1985.     "011212031": [[, , , , 1, 1, 1, , 1]],
  1986.     "011220112": [[1, , , , , 1, 1, 1, ]],
  1987.     "011221122": [[, , , , 1, 1, 1, 1, ]],
  1988.     "020112111": [[1, , 1, , , , , 1, 1]],
  1989.     "020113121": [[, , 1, , 1, , , 1, 1]],
  1990.     "020202020": [[1, , 1, , , , 1, , 1]],
  1991.     "020203030": [[, , 1, , 1, , 1, , 1]],
  1992.     "020211111": [[1, , 1, , , , 1, 1, ]],
  1993.     "020212121": [[, , 1, , 1, , 1, 1, ], [1, , , , 1, , , 1, 1]],
  1994.     "020302030": [[1, , , , 1, , 1, , 1]],
  1995.     "020311121": [[1, , , , 1, , 1, 1, ]],
  1996.     "021112011": [[1, , 1, , , 1, , , 1]],
  1997.     "021113021": [[, , 1, , 1, 1, , , 1]],
  1998.     "021121102": [[1, , 1, , , 1, , 1, ]],
  1999.     "021122112": [[, , 1, , 1, 1, , 1, ]],
  2000.     "021211011": [[1, , 1, , , 1, 1, , ]],
  2001.     "021212021": [[, , 1, , 1, 1, 1, , ], [1, , , , 1, 1, , , 1]],
  2002.     "021221112": [[1, , , , 1, 1, , 1, ]],
  2003.     "021311021": [[1, , , , 1, 1, 1, , ]],
  2004.     "030203020": [[1, , 1, , 1, , , , 1]],
  2005.     "030212111": [[1, , 1, , 1, , , 1, ]],
  2006.     "030302020": [[1, , 1, , 1, , 1, , ]],
  2007.     "031212011": [[1, , 1, , 1, 1, , , ]],
  2008.     "100121221": [[, , , 1, , , 1, 1, 1]],
  2009.     "101031212": [[, , , 1, , 1, , 1, 1]],
  2010.     "101121121": [[, , , 1, , 1, 1, , 1], [, 1, , , , , 1, 1, 1]],
  2011.     "101130212": [[, , , 1, , 1, 1, 1, ]],
  2012.     "102031112": [[, 1, , , , 1, , 1, 1]],
  2013.     "102121021": [[, 1, , , , 1, 1, , 1]],
  2014.     "102130112": [[, 1, , , , 1, 1, 1, ]],
  2015.     "110022211": [[, , 1, 1, , , , 1, 1]],
  2016.     "110112120": [[, , 1, 1, , , 1, , 1]],
  2017.     "110121211": [[, , 1, 1, , , 1, 1, ], [1, , , 1, , , , 1, 1]],
  2018.     "110122221": [[, , , 1, 1, , , 1, 1]],
  2019.     "110211120": [[1, , , 1, , , 1, , 1]],
  2020.     "110212130": [[, , , 1, 1, , 1, , 1]],
  2021.     "110220211": [[1, , , 1, , , 1, 1, ]],
  2022.     "110221221": [[, , , 1, 1, , 1, 1, ]],
  2023.     "111022111": [[, , 1, 1, , 1, , , 1], [, 1, 1, , , , , 1, 1]],
  2024.     "111031202": [[, , 1, 1, , 1, , 1, ]],
  2025.     "111112020": [[, 1, 1, , , , 1, , 1]],
  2026.     "111121111": [[, , 1, 1, , 1, 1, , ], [, 1, 1, , , , 1, 1, ], [1, , , 1, , 1, , , 1], [1, 1, , , , , , 1, 1]],
  2027.     "111122121": [[, , , 1, 1, 1, , , 1], [, 1, , , 1, , , 1, 1]],
  2028.     "111130202": [[1, , , 1, , 1, , 1, ]],
  2029.     "111131212": [[, , , 1, 1, 1, , 1, ]],
  2030.     "111211020": [[1, 1, , , , , 1, , 1]],
  2031.     "111212030": [[, 1, , , 1, , 1, , 1]],
  2032.     "111220111": [[1, , , 1, , 1, 1, , ], [1, 1, , , , , 1, 1, ]],
  2033.     "111221121": [[, , , 1, 1, 1, 1, , ], [, 1, , , 1, , 1, 1, ]],
  2034.     "112022011": [[, 1, 1, , , 1, , , 1]],
  2035.     "112031102": [[, 1, 1, , , 1, , 1, ]],
  2036.     "112121011": [[, 1, 1, , , 1, 1, , ], [1, 1, , , , 1, , , 1]],
  2037.     "112122021": [[, 1, , , 1, 1, , , 1]],
  2038.     "112130102": [[1, 1, , , , 1, , 1, ]],
  2039.     "112131112": [[, 1, , , 1, 1, , 1, ]],
  2040.     "112220011": [[1, 1, , , , 1, 1, , ]],
  2041.     "112221021": [[, 1, , , 1, 1, 1, , ]],
  2042.     "120112110": [[1, , 1, 1, , , , , 1]],
  2043.     "120113120": [[, , 1, 1, 1, , , , 1]],
  2044.     "120121201": [[1, , 1, 1, , , , 1, ]],
  2045.     "120122211": [[, , 1, 1, 1, , , 1, ]],
  2046.     "120211110": [[1, , 1, 1, , , 1, , ]],
  2047.     "120212120": [[, , 1, 1, 1, , 1, , ], [1, , , 1, 1, , , , 1]],
  2048.     "120221211": [[1, , , 1, 1, , , 1, ]],
  2049.     "120311120": [[1, , , 1, 1, , 1, , ]],
  2050.     "121112010": [[1, 1, 1, , , , , , 1]],
  2051.     "121113020": [[, 1, 1, , 1, , , , 1]],
  2052.     "121121101": [[1, , 1, 1, , 1, , , ], [1, 1, 1, , , , , 1, ]],
  2053.     "121122111": [[, , 1, 1, 1, 1, , , ], [, 1, 1, , 1, , , 1, ]],
  2054.     "121211010": [[1, 1, 1, , , , 1, , ]],
  2055.     "121212020": [[, 1, 1, , 1, , 1, , ], [1, 1, , , 1, , , , 1]],
  2056.     "121221111": [[1, , , 1, 1, 1, , , ], [1, 1, , , 1, , , 1, ]],
  2057.     "121311020": [[1, 1, , , 1, , 1, , ]],
  2058.     "122121001": [[1, 1, 1, , , 1, , , ]],
  2059.     "122122011": [[, 1, 1, , 1, 1, , , ]],
  2060.     "122221011": [[1, 1, , , 1, 1, , , ]],
  2061.     "130212110": [[1, , 1, 1, 1, , , , ]],
  2062.     "131212010": [[1, 1, 1, , 1, , , , ]],
  2063.     "201031211": [[, 1, , 1, , , , 1, 1]],
  2064.     "201121120": [[, 1, , 1, , , 1, , 1]],
  2065.     "201130211": [[, 1, , 1, , , 1, 1, ]],
  2066.     "202031111": [[, 1, , 1, , 1, , , 1]],
  2067.     "202040202": [[, 1, , 1, , 1, , 1, ]],
  2068.     "202130111": [[, 1, , 1, , 1, 1, , ]],
  2069.     "211022110": [[, 1, 1, 1, , , , , 1]],
  2070.     "211031201": [[, 1, 1, 1, , , , 1, ]],
  2071.     "211121110": [[, 1, 1, 1, , , 1, , ], [1, 1, , 1, , , , , 1]],
  2072.     "211122120": [[, 1, , 1, 1, , , , 1]],
  2073.     "211130201": [[1, 1, , 1, , , , 1, ]],
  2074.     "211131211": [[, 1, , 1, 1, , , 1, ]],
  2075.     "211220110": [[1, 1, , 1, , , 1, , ]],
  2076.     "211221120": [[, 1, , 1, 1, , 1, , ]],
  2077.     "212031101": [[, 1, 1, 1, , 1, , , ]],
  2078.     "212130101": [[1, 1, , 1, , 1, , , ]],
  2079.     "212131111": [[, 1, , 1, 1, 1, , , ]],
  2080.     "221121100": [[1, 1, 1, 1, , , , , ]],
  2081.     "221122110": [[, 1, 1, 1, 1, , , , ]],
  2082.     "221221110": [[1, 1, , 1, 1, , , , ]]
  2083. };
  2084. var fourColorsCombinations = {
  2085.     key: [0, 0, 1, 2],
  2086.     "00": {
  2087.         key: [3, 3, 3, 3]
  2088.     },
  2089.     "01": {
  2090.         key: [2, 3, 3, 3],
  2091.         "10": {
  2092.             key: [1, 1, 3, 1]
  2093.         },
  2094.         "11": {
  2095.             key: [3, 1, 3, 1]
  2096.         },
  2097.         "12": {
  2098.             key: [3, 2, 2, 3]
  2099.         },
  2100.         "20": {
  2101.             key: [1, 1, 3, 3],
  2102.             "10": {
  2103.                 key: [2, 2, 2, 3]
  2104.             },
  2105.             "22": {
  2106.                 key: [1, 3, 3, 1]
  2107.             }
  2108.         },
  2109.         "21": {
  2110.             key: [3, 3, 3, 1],
  2111.             "21": {
  2112.                 key: [3, 3, 0, 3]
  2113.             },
  2114.             "22": {
  2115.                 key: [3, 1, 3, 3]
  2116.             },
  2117.             "30": {
  2118.                 key: [3, 3, 3, 0]
  2119.             }
  2120.         },
  2121.         "22": {
  2122.             key: [3, 3, 2, 3],
  2123.             "22": {
  2124.                 key: [3, 2, 3, 3]
  2125.             }
  2126.         },
  2127.         "30": {
  2128.             key: [2, 2, 3, 3],
  2129.             "20": {
  2130.                 key: [1, 3, 3, 3]
  2131.             },
  2132.             "22": {
  2133.                 key: [2, 3, 2, 3]
  2134.             }
  2135.         }
  2136.     },
  2137.     "02": {
  2138.         key: [3, 3, 0, 1],
  2139.         "01": {
  2140.             key: [2, 2, 2, 0]
  2141.         },
  2142.         "02": {
  2143.             key: [1, 2, 2, 3],
  2144.             "12": {
  2145.                 key: [2, 2, 3, 0]
  2146.             },
  2147.             "22": {
  2148.                 key: [2, 1, 2, 3]
  2149.             },
  2150.             "30": {
  2151.                 key: [1, 1, 2, 3]
  2152.             }
  2153.         },
  2154.         "03": {
  2155.             key: [1, 2, 3, 3],
  2156.             "20": {
  2157.                 key: [1, 1, 3, 0]
  2158.             },
  2159.             "22": {
  2160.                 key: [2, 1, 3, 3]
  2161.             }
  2162.         },
  2163.         "10": {
  2164.             key: [2, 2, 2, 1],
  2165.             "20": {
  2166.                 key: [1, 1, 2, 1]
  2167.             },
  2168.             "30": {
  2169.                 key: [1, 2, 2, 1],
  2170.                 "22": {
  2171.                     key: [2, 1, 2, 1]
  2172.                 }
  2173.             }
  2174.         },
  2175.         "11": {
  2176.             key: [3, 2, 2, 0],
  2177.             "02": {
  2178.                 key: [2, 1, 3, 1]
  2179.             },
  2180.             "11": {
  2181.                 key: [1, 2, 3, 1]
  2182.             },
  2183.             "12": {
  2184.                 key: [2, 2, 3, 1]
  2185.             },
  2186.             "13": {
  2187.                 key: [2, 2, 0, 3]
  2188.             },
  2189.             "22": {
  2190.                 key: [2, 3, 2, 0]
  2191.             }
  2192.         },
  2193.         "12": {
  2194.             key: [3, 2, 3, 0],
  2195.             "02": {
  2196.                 key: [1, 1, 0, 3]
  2197.             },
  2198.             "03": {
  2199.                 key: [1, 3, 2, 3]
  2200.             },
  2201.             "12": {
  2202.                 key: [3, 1, 2, 3]
  2203.             },
  2204.             "22": {
  2205.                 key: [2, 3, 3, 0]
  2206.             }
  2207.         },
  2208.         "13": {
  2209.             key: [1, 3, 3, 0],
  2210.             "22": {
  2211.                 key: [3, 1, 3, 0]
  2212.             }
  2213.         },
  2214.         "20": {
  2215.             key: [3, 2, 2, 1],
  2216.             "10": {
  2217.                 key: [1, 1, 0, 1]
  2218.             },
  2219.             "21": {
  2220.                 key: [1, 3, 2, 1]
  2221.             },
  2222.             "22": {
  2223.                 key: [2, 3, 2, 1]
  2224.             },
  2225.             "30": {
  2226.                 key: [3, 1, 2, 1]
  2227.             }
  2228.         },
  2229.         "21": {
  2230.             key: [2, 3, 3, 1],
  2231.             "03": {
  2232.                 key: [3, 2, 0, 3]
  2233.             },
  2234.             "12": {
  2235.                 key: [3, 3, 2, 0]
  2236.             },
  2237.             "21": {
  2238.                 key: [2, 3, 0, 3]
  2239.             },
  2240.             "22": {
  2241.                 key: [3, 2, 3, 1]
  2242.             }
  2243.         },
  2244.         "22": {
  2245.             key: [3, 1, 0, 3],
  2246.             "22": {
  2247.                 key: [1, 3, 0, 3]
  2248.             }
  2249.         },
  2250.         "30": {
  2251.             key: [1, 3, 0, 1],
  2252.             "20": {
  2253.                 key: [3, 3, 0, 0],
  2254.                 "20": {
  2255.                     key: [3, 3, 2, 1]
  2256.                 }
  2257.             },
  2258.             "22": {
  2259.                 key: [3, 1, 0, 1]
  2260.             }
  2261.         }
  2262.     },
  2263.     "03": {
  2264.         key: [1, 3, 2, 0],
  2265.         "03": {
  2266.             key: [2, 1, 0, 1],
  2267.             "30": {
  2268.                 key: [2, 2, 0, 1]
  2269.             }
  2270.         },
  2271.         "04": {
  2272.             key: [2, 1, 0, 3],
  2273.             "13": {
  2274.                 key: [3, 2, 0, 1]
  2275.             }
  2276.         },
  2277.         "11": {
  2278.             key: [2, 2, 0, 0]
  2279.         },
  2280.         "12": {
  2281.             key: [1, 2, 0, 1],
  2282.             "11": {
  2283.                 key: [3, 1, 0, 0]
  2284.             },
  2285.             "20": {
  2286.                 key: [3, 2, 0, 0]
  2287.             }
  2288.         },
  2289.         "13": {
  2290.             key: [1, 2, 0, 3],
  2291.             "04": {
  2292.                 key: [2, 1, 3, 0]
  2293.             },
  2294.             "13": {
  2295.                 key: [2, 3, 0, 1]
  2296.             }
  2297.         },
  2298.         "20": {
  2299.             key: [1, 1, 0, 0]
  2300.         },
  2301.         "21": {
  2302.             key: [2, 1, 2, 0],
  2303.             "20": {
  2304.                 key: [2, 3, 0, 0]
  2305.             }
  2306.         },
  2307.         "22": {
  2308.             key: [1, 2, 3, 0],
  2309.             "13": {
  2310.                 key: [3, 1, 2, 0]
  2311.             }
  2312.         },
  2313.         "30": {
  2314.             key: [1, 1, 2, 0],
  2315.             "20": {
  2316.                 key: [1, 3, 0, 0]
  2317.             },
  2318.             "30": {
  2319.                 key: [1, 2, 2, 0]
  2320.             }
  2321.         }
  2322.     },
  2323.     "04": {
  2324.         key: [2, 1, 0, 0],
  2325.         "22": {
  2326.             key: [1, 2, 0, 0]
  2327.         }
  2328.     },
  2329.     "10": {
  2330.         key: [0, 3, 3, 3],
  2331.         "00": {
  2332.             key: [1, 1, 1, 1],
  2333.             "00": {
  2334.                 key: [2, 2, 2, 2]
  2335.             }
  2336.         },
  2337.         "01": {
  2338.             key: [3, 1, 1, 1],
  2339.             "10": {
  2340.                 key: [3, 2, 2, 2]
  2341.             }
  2342.         },
  2343.         "10": {
  2344.             key: [1, 3, 1, 1],
  2345.             "01": {
  2346.                 key: [2, 2, 3, 2]
  2347.             },
  2348.             "10": {
  2349.                 key: [2, 3, 2, 2]
  2350.             },
  2351.             "22": {
  2352.                 key: [1, 1, 1, 3]
  2353.             }
  2354.         },
  2355.         "11": {
  2356.             key: [3, 3, 1, 1],
  2357.             "11": {
  2358.                 key: [3, 2, 3, 2]
  2359.             },
  2360.             "20": {
  2361.                 key: [3, 3, 2, 2]
  2362.             },
  2363.             "22": {
  2364.                 key: [3, 1, 1, 3]
  2365.             }
  2366.         },
  2367.         "20": {
  2368.             key: [2, 3, 3, 2],
  2369.             "11": {
  2370.                 key: [1, 3, 1, 3]
  2371.             }
  2372.         },
  2373.         "21": {
  2374.             key: [3, 3, 3, 2],
  2375.             "21": {
  2376.                 key: [3, 3, 1, 3]
  2377.             }
  2378.         },
  2379.         "22": {
  2380.             key: [3, 0, 3, 3]
  2381.         }
  2382.     },
  2383.     "11": {
  2384.         key: [0, 3, 0, 3],
  2385.         "00": {
  2386.             key: [1, 2, 1, 1],
  2387.             "02": {
  2388.                 key: [2, 1, 2, 2]
  2389.             },
  2390.             "12": {
  2391.                 key: [1, 1, 2, 2]
  2392.             },
  2393.             "20": {
  2394.                 key: [1, 2, 2, 2]
  2395.             },
  2396.             "22": {
  2397.                 key: [2, 1, 1, 1]
  2398.             },
  2399.             "30": {
  2400.                 key: [2, 2, 1, 1]
  2401.             }
  2402.         },
  2403.         "01": {
  2404.             key: [1, 2, 3, 2],
  2405.             "10": {
  2406.                 key: [1, 1, 1, 0]
  2407.             },
  2408.             "12": {
  2409.                 key: [3, 2, 1, 1]
  2410.             },
  2411.             "13": {
  2412.                 key: [3, 1, 2, 2]
  2413.             },
  2414.             "22": {
  2415.                 key: [2, 1, 3, 2]
  2416.             },
  2417.             "30": {
  2418.                 key: [1, 1, 3, 2]
  2419.             }
  2420.         },
  2421.         "02": {
  2422.             key: [3, 1, 3, 2],
  2423.             "11": {
  2424.                 key: [1, 0, 3, 1]
  2425.             },
  2426.             "20": {
  2427.                 key: [3, 1, 1, 0]
  2428.             }
  2429.         },
  2430.         "03": {
  2431.             key: [3, 0, 3, 1]
  2432.         },
  2433.         "04": {
  2434.             key: [3, 0, 3, 0]
  2435.         },
  2436.         "10": {
  2437.             key: [1, 2, 1, 3],
  2438.             "10": {
  2439.                 key: [2, 2, 0, 2]
  2440.             },
  2441.             "12": {
  2442.                 key: [1, 3, 2, 2]
  2443.             },
  2444.             "13": {
  2445.                 key: [2, 3, 1, 1]
  2446.             },
  2447.             "22": {
  2448.                 key: [2, 1, 1, 3]
  2449.             },
  2450.             "30": {
  2451.                 key: [2, 2, 1, 3]
  2452.             }
  2453.         },
  2454.         "11": {
  2455.             key: [3, 2, 0, 2],
  2456.             "02": {
  2457.                 key: [1, 3, 1, 0],
  2458.                 "04": {
  2459.                     key: [0, 1, 3, 1]
  2460.                 }
  2461.             },
  2462.             "04": {
  2463.                 key: [2, 0, 2, 3]
  2464.             },
  2465.             "11": {
  2466.                 key: [1, 3, 3, 2]
  2467.             },
  2468.             "20": {
  2469.                 key: [3, 2, 1, 3]
  2470.             }
  2471.         },
  2472.         "12": {
  2473.             key: [2, 0, 3, 3],
  2474.             "03": {
  2475.                 key: [3, 3, 1, 0]
  2476.             },
  2477.             "11": {
  2478.                 key: [3, 0, 0, 0]
  2479.             },
  2480.             "22": {
  2481.                 key: [3, 0, 2, 3]
  2482.             },
  2483.             "30": {
  2484.                 key: [1, 0, 3, 3]
  2485.             }
  2486.         },
  2487.         "20": {
  2488.             key: [0, 2, 2, 3],
  2489.             "04": {
  2490.                 key: [2, 3, 0, 2]
  2491.             },
  2492.             "11": {
  2493.                 key: [2, 3, 1, 3]
  2494.             }
  2495.         },
  2496.         "21": {
  2497.             key: [0, 1, 3, 3],
  2498.             "03": {
  2499.                 key: [3, 3, 0, 2]
  2500.             },
  2501.             "22": {
  2502.                 key: [0, 3, 3, 1]
  2503.             },
  2504.             "30": {
  2505.                 key: [0, 2, 3, 3]
  2506.             }
  2507.         },
  2508.         "22": {
  2509.             key: [0, 3, 3, 0],
  2510.             "04": {
  2511.                 key: [3, 0, 0, 3]
  2512.             }
  2513.         },
  2514.         "30": {
  2515.             key: [0, 3, 0, 0],
  2516.             "20": {
  2517.                 key: [0, 3, 2, 3]
  2518.             }
  2519.         }
  2520.     },
  2521.     "12": {
  2522.         key: [0, 1, 2, 1],
  2523.         "02": {
  2524.             key: [1, 0, 0, 3],
  2525.             "12": {
  2526.                 key: [2, 0, 3, 0]
  2527.             },
  2528.             "20": {
  2529.                 key: [2, 0, 0, 0]
  2530.             },
  2531.             "22": {
  2532.                 key: [1, 0, 3, 0]
  2533.             },
  2534.             "30": {
  2535.                 key: [1, 0, 0, 0],
  2536.                 "20": {
  2537.                     key: [2, 0, 0, 3]
  2538.                 }
  2539.             }
  2540.         },
  2541.         "03": {
  2542.             key: [1, 2, 0, 2],
  2543.             "03": {
  2544.                 key: [2, 3, 1, 0]
  2545.             },
  2546.             "12": {
  2547.                 key: [3, 2, 1, 0]
  2548.             },
  2549.             "13": {
  2550.                 key: [2, 2, 1, 0]
  2551.             },
  2552.             "30": {
  2553.                 key: [1, 3, 0, 2]
  2554.             }
  2555.         },
  2556.         "04": {
  2557.             key: [1, 2, 1, 0]
  2558.         },
  2559.         "11": {
  2560.             key: [0, 2, 0, 3],
  2561.             "03": {
  2562.                 key: [2, 0, 2, 0]
  2563.             },
  2564.             "04": {
  2565.                 key: [3, 0, 2, 0]
  2566.             },
  2567.             "12": {
  2568.                 key: [3, 0, 0, 1]
  2569.             },
  2570.             "22": {
  2571.                 key: [0, 2, 3, 0]
  2572.             },
  2573.             "30": {
  2574.                 key: [0, 2, 0, 0]
  2575.             }
  2576.         },
  2577.         "12": {
  2578.             key: [1, 0, 2, 3],
  2579.             "03": {
  2580.                 key: [2, 1, 0, 2]
  2581.             },
  2582.             "04": {
  2583.                 key: [3, 1, 0, 2]
  2584.             },
  2585.             "13": {
  2586.                 key: [2, 0, 3, 1]
  2587.             },
  2588.             "20": {
  2589.                 key: [1, 0, 0, 1]
  2590.             }
  2591.         },
  2592.         "13": {
  2593.             key: [1, 1, 0, 2],
  2594.             "13": {
  2595.                 key: [2, 1, 1, 0]
  2596.             }
  2597.         },
  2598.         "20": {
  2599.             key: [0, 1, 3, 0],
  2600.             "13": {
  2601.                 key: [0, 3, 0, 1]
  2602.             },
  2603.             "20": {
  2604.                 key: [0, 2, 2, 0]
  2605.             },
  2606.             "21": {
  2607.                 key: [0, 3, 2, 0]
  2608.             },
  2609.             "22": {
  2610.                 key: [0, 1, 0, 3]
  2611.             },
  2612.             "30": {
  2613.                 key: [0, 1, 0, 0]
  2614.             }
  2615.         },
  2616.         "21": {
  2617.             key: [0, 2, 3, 1],
  2618.             "12": {
  2619.                 key: [2, 0, 2, 1]
  2620.             },
  2621.             "13": {
  2622.                 key: [3, 0, 2, 1]
  2623.             }
  2624.         },
  2625.         "22": {
  2626.             key: [1, 0, 2, 1]
  2627.         },
  2628.         "30": {
  2629.             key: [0, 2, 2, 1],
  2630.             "20": {
  2631.                 key: [0, 1, 0, 1]
  2632.             },
  2633.             "21": {
  2634.                 key: [0, 1, 2, 3]
  2635.             },
  2636.             "30": {
  2637.                 key: [0, 3, 2, 1]
  2638.             }
  2639.         }
  2640.     },
  2641.     "13": {
  2642.         key: [0, 1, 2, 0],
  2643.         "04": {
  2644.             key: [2, 0, 0, 1]
  2645.         },
  2646.         "13": {
  2647.             key: [0, 2, 0, 1]
  2648.         },
  2649.         "22": {
  2650.             key: [1, 0, 2, 0]
  2651.         }
  2652.     },
  2653.     "20": {
  2654.         key: [0, 0, 3, 3],
  2655.         "00": {
  2656.             key: [1, 2, 1, 2],
  2657.             "22": {
  2658.                 key: [2, 1, 1, 2]
  2659.             },
  2660.             "30": {
  2661.                 key: [1, 1, 1, 2],
  2662.                 "20": {
  2663.                     key: [2, 2, 1, 2]
  2664.                 }
  2665.             }
  2666.         },
  2667.         "01": {
  2668.             key: [1, 3, 1, 2],
  2669.             "21": {
  2670.                 key: [3, 2, 1, 2]
  2671.             },
  2672.             "22": {
  2673.                 key: [3, 1, 1, 2]
  2674.             },
  2675.             "30": {
  2676.                 key: [2, 3, 1, 2]
  2677.             }
  2678.         },
  2679.         "02": {
  2680.             key: [3, 3, 1, 2]
  2681.         },
  2682.         "10": {
  2683.             key: [0, 1, 1, 1],
  2684.             "01": {
  2685.                 key: [2, 0, 2, 2]
  2686.             },
  2687.             "10": {
  2688.                 key: [0, 2, 2, 2]
  2689.             },
  2690.             "22": {
  2691.                 key: [1, 0, 1, 1]
  2692.             }
  2693.         },
  2694.         "11": {
  2695.             key: [0, 3, 1, 1],
  2696.             "02": {
  2697.                 key: [3, 0, 2, 2]
  2698.             },
  2699.             "20": {
  2700.                 key: [0, 3, 2, 2]
  2701.             },
  2702.             "22": {
  2703.                 key: [3, 0, 1, 1]
  2704.             }
  2705.         },
  2706.         "20": {
  2707.             key: [0, 1, 1, 3],
  2708.             "02": {
  2709.                 key: [2, 0, 3, 2]
  2710.             },
  2711.             "10": {
  2712.                 key: [0, 0, 0, 0]
  2713.             },
  2714.             "11": {
  2715.                 key: [0, 2, 3, 2]
  2716.             },
  2717.             "22": {
  2718.                 key: [1, 0, 1, 3]
  2719.             }
  2720.         },
  2721.         "21": {
  2722.             key: [0, 3, 1, 3],
  2723.             "03": {
  2724.                 key: [3, 0, 3, 2]
  2725.             },
  2726.             "21": {
  2727.                 key: [0, 3, 3, 2]
  2728.             },
  2729.             "22": {
  2730.                 key: [3, 0, 1, 3]
  2731.             }
  2732.         },
  2733.         "30": {
  2734.             key: [0, 0, 0, 3],
  2735.             "22": {
  2736.                 key: [0, 0, 3, 0]
  2737.             }
  2738.         }
  2739.     },
  2740.     "21": {
  2741.         key: [1, 0, 2, 2],
  2742.         "02": {
  2743.             key: [0, 1, 1, 0],
  2744.             "30": {
  2745.                 key: [0, 3, 1, 0]
  2746.             }
  2747.         },
  2748.         "03": {
  2749.             key: [0, 2, 1, 1],
  2750.             "30": {
  2751.                 key: [0, 2, 1, 3]
  2752.             }
  2753.         },
  2754.         "11": {
  2755.             key: [0, 0, 0, 1],
  2756.             "12": {
  2757.                 key: [3, 0, 1, 0]
  2758.             },
  2759.             "20": {
  2760.                 key: [0, 3, 0, 2]
  2761.             },
  2762.             "30": {
  2763.                 key: [0, 0, 3, 1]
  2764.             }
  2765.         },
  2766.         "12": {
  2767.             key: [0, 1, 3, 2],
  2768.             "03": {
  2769.                 key: [2, 0, 1, 1]
  2770.             },
  2771.             "04": {
  2772.                 key: [2, 0, 1, 3]
  2773.             },
  2774.             "20": {
  2775.                 key: [0, 2, 0, 2]
  2776.             }
  2777.         },
  2778.         "20": {
  2779.             key: [0, 0, 2, 0],
  2780.             "12": {
  2781.                 key: [3, 0, 0, 2]
  2782.             },
  2783.             "20": {
  2784.                 key: [1, 0, 1, 0]
  2785.             },
  2786.             "30": {
  2787.                 key: [0, 0, 2, 3]
  2788.             }
  2789.         },
  2790.         "21": {
  2791.             key: [2, 0, 0, 2]
  2792.         },
  2793.         "22": {
  2794.             key: [0, 1, 2, 2]
  2795.         },
  2796.         "30": {
  2797.             key: [1, 0, 3, 2]
  2798.         }
  2799.     },
  2800.     "22": {
  2801.         key: [2, 0, 1, 0],
  2802.         "04": {
  2803.             key: [0, 1, 0, 2]
  2804.         },
  2805.         "13": {
  2806.             key: [0, 0, 2, 1],
  2807.             "13": {
  2808.                 key: [1, 0, 0, 2]
  2809.             }
  2810.         },
  2811.         "22": {
  2812.             key: [0, 2, 1, 0]
  2813.         }
  2814.     },
  2815.     "30": {
  2816.         key: [0, 3, 1, 2],
  2817.         "20": {
  2818.             key: [0, 0, 0, 2],
  2819.             "20": {
  2820.                 key: [0, 0, 1, 1]
  2821.             },
  2822.             "21": {
  2823.                 key: [0, 0, 1, 0]
  2824.             },
  2825.             "30": {
  2826.                 key: [0, 0, 2, 2]
  2827.             }
  2828.         },
  2829.         "21": {
  2830.             key: [0, 0, 1, 3],
  2831.             "20": {
  2832.                 key: [1, 0, 1, 2],
  2833.                 "30": {
  2834.                     key: [2, 0, 1, 2]
  2835.                 }
  2836.             },
  2837.             "21": {
  2838.                 key: [0, 0, 3, 2]
  2839.             }
  2840.         },
  2841.         "22": {
  2842.             key: [3, 0, 1, 2]
  2843.         },
  2844.         "30": {
  2845.             key: [0, 2, 1, 2],
  2846.             "30": {
  2847.                 key: [0, 1, 1, 2]
  2848.             }
  2849.         }
  2850.     }
  2851. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement