[ Zorr.PRO ] Auto Craft

Autocraft for zorr.pro with different modes

  1. // ==UserScript==
  2. // @name [ Zorr.PRO ] Auto Craft
  3. // @version 1.8
  4. // @description Autocraft for zorr.pro with different modes
  5. // @author Pixey Fr
  6. // @match https://zorr.pro/*
  7. // @license GNU GPLv3
  8. // @grant none
  9. // @namespace https://greasyfork.org/users/1107724
  10. // ==/UserScript==
  11.  
  12. /*
  13. INFO:
  14. This is the simplistic version of the script, if you experience any bugs while using please report them to me on discord,
  15. username : `pixeyfr`, you can ping me in the zorr discord server if i dont respond to ur dm!
  16. /*
  17. Modes:
  18. - conservative: Only craft petals that are mythic or lower and with a total count above a set threshold (default: >10).
  19. - bruteForce: Craft any petal. (USE AT YOUR OWN RISK. WILL CRAFT EVERYTHING.)
  20. - simulate: Simulate success probability using P(success)=1-(1-p)^n, craft if the probability is >= a set threshold (default: 50%).
  21. - adaptive: Blends brute force and simulate logic; requires a minimum count and meets a probability threshold.
  22. */
  23.  
  24. (async function() {
  25. 'use strict';
  26.  
  27. const settings = {
  28. desiredCount: 50,
  29. cooldown: 250,
  30. mode: 'conservative', // options: 'conservative', 'bruteForce', 'simulate', 'adaptive'
  31. conservativeMinCount: 10,
  32. conservativeMaxRarityLevel: 5,
  33. simulateProbabilityThreshold: 0.5,
  34. adaptiveMinCount: 5,
  35. adaptiveProbabilityThreshold: 0.5
  36. };
  37.  
  38. const wait = ms => new Promise(res => setTimeout(res, ms));
  39.  
  40. const rarityMap = {
  41. 'rarity-bg-0': { level: 0, chance: 0.4 }, // common
  42. 'rarity-bg-1': { level: 1, chance: 0.3 }, // uncommon
  43. 'rarity-bg-2': { level: 2, chance: 0.2 }, // rare
  44. 'rarity-bg-3': { level: 3, chance: 0.1 }, // epic
  45. 'rarity-bg-4': { level: 4, chance: 0.03 }, // legendary
  46. 'rarity-bg-5': { level: 5, chance: 0.02 }, // mythic
  47. 'rarity-bg-6': { level: 6, chance: 0.01 }, // ultra
  48. 'rarity-bg-7': { level: 7, chance: 0 } // super ( does not craft supers currently )
  49. };
  50.  
  51. const modes = {
  52. conservative: p => p.rarity.level < settings.conservativeMaxRarityLevel && p.count > settings.conservativeMinCount,
  53. bruteForce: _ => true,
  54. simulate: p => 1 - Math.pow(1 - p.rarity.chance, p.count) >= settings.simulateProbabilityThreshold,
  55. adaptive: p => p.count >= settings.adaptiveMinCount &&
  56. 1 - Math.pow(1 - p.rarity.chance, p.count) >= settings.adaptiveProbabilityThreshold
  57. };
  58.  
  59. const getPetals = () =>
  60. [...document.querySelectorAll('.dialog-content .petal')].map(el => {
  61. const rClass = [...el.classList].find(c => c.startsWith('rarity-bg-'));
  62. const count = parseInt((el.querySelector('.petal-count')?.getAttribute('stroke') || 'x0').replace('x',''));
  63. return { el, count, rarity: rarityMap[rClass] || rarityMap['rarity-bg-0'] };
  64. });
  65.  
  66. const saveData = () => {
  67. try {
  68. localStorage.setItem("autocraft_data", JSON.stringify(getPetals()));
  69. } catch (e) {}
  70. };
  71.  
  72. const craft = async () => {
  73. const petals = getPetals();
  74. const candidates = petals.filter(p => modes[settings.mode](p))
  75. .sort((a, b) => a.rarity.level - b.rarity.level);
  76. if (!candidates.length) return false;
  77. const petal = candidates[0];
  78. const clicks = Math.ceil(settings.desiredCount / 5);
  79. for (let i = 0; i < clicks; i++) {
  80. petal.el.click();
  81. await wait(settings.cooldown);
  82. }
  83. const btn = document.querySelector('.btn.craft-btn');
  84. if (btn) {
  85. btn.click();
  86. await wait(settings.cooldown);
  87. }
  88. let result = document.querySelector('.craft-result');
  89. while (result) {
  90. const style = getComputedStyle(result);
  91. if (style.transform === 'none') break;
  92. const match = style.transform.match(/matrix\(([^)]+)\)/);
  93. if (match) {
  94. const [a, b] = match[1].split(',').map(parseFloat);
  95. const scale = Math.sqrt(a * a + b * b);
  96. if (scale === 0) break;
  97. }
  98. result.click();
  99. await wait(settings.cooldown);
  100. result = document.querySelector('.craft-result');
  101. }
  102. saveData();
  103. return true;
  104. };
  105.  
  106. const loop = async () => {
  107. while (true) {
  108. const crafted = await craft();
  109. if (!crafted) await wait(5000);
  110. }
  111. };
  112.  
  113. console.log("[Auto Craft] Running immediately.");
  114. loop();
  115. })();