Mxo bot

快速、自動安全且易於配置的菜單

目前為 2023-07-23 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Mxo bot
  3. // @name:tr Mxo bot
  4. // @namespace https://i.imgur.com/gLazoQg.png
  5. // @version 1.7
  6. // @description Fast, Auto Secure And Easiest To Confugre With Menu
  7. // @description:tr Hızlı, Oto Korumalı Ve Kolay Ayarlanılabilinir Menü
  8. // @description:ar سريع وآمن تلقائيًا وأسهل للتكوين مع القائمة
  9. // @description:bg Бързо, автоматично защитено и най-лесно за конфигуриране с меню
  10. // @description:cs Rychlé, automaticky zabezpečené a nejjednodušší k použití s nabídkou
  11. // @description:da Hurtig, Auto Sikker Og Nemmest At Konfigurere Med Menu
  12. // @description:de Schnell, automatisch gesichert und am einfachsten zu konfigurieren mit Menü
  13. // @description:el Γρήγορο, αυτόματο και εύκολο να διαμορφωθεί με το μενού
  14. // @description:en Fast, Auto Secure And Easiest To Confugre With Menu
  15. // @description:eo Rapida, Aŭto Sekura Kaj Plej Facila Al Konfuzi Kun Menuo
  16. // @description:es Rápido, seguro y fácil de configurar con menú
  17. // @description:fi Nopea, automaattisesti suojattu ja helposti määritettävissä oleva valikon kanssa
  18. // @description:fr Rapide, sécurisé automatiquement et le plus facile à configurer avec le menu
  19. // @description:fr-CA Rapide, sécurisé automatiquement et le plus facile à configurer avec le menu
  20. // @description:he מהיר, מאובטח וקל להגדרה עם תפריט
  21. // @description:hu Gyors, automatikus biztonság és könnyen konfigurálható menüvel
  22. // @description:id Cepat, Auto Aman Dan Paling Mudah Dikonfigurasi Dengan Menu
  23. // @description:it Veloce, Auto Sicuro E Più Semplice Da Configurare Con Menù
  24. // @description:ja 速くて、自動的に安全で設定が簡単なメニュー付き
  25. // @description:ka სწრაფი, ავტო დაცული და ყველაზე მარტივი კონფიგურაცია მენიუთი
  26. // @description:ko 빠르고 자동으로 보안이 되며 메뉴로 구성하기 가장 쉬운
  27. // @description:nb Rask, automatisk sikker og enkel å konfigurere med meny
  28. // @description:nl Snel, automatisch beveiligd en gemakkelijk te configureren met menu
  29. // @description:pl Szybki, automatycznie zabezpieczony i łatwy w konfiguracji z menu
  30. // @description:pt-BR Rápido, Automático, Seguro e Mais Fácil de Configurar com Menu
  31. // @description:ro Rapid, Securizare Automată și Ușor de Configurat Cu Meniu
  32. // @description:ru Быстро, автоматически защищено и проще всего настроить с меню
  33. // @description:sk Rýchle, automaticky zabezpečené a najjednoduchšie na konfiguráciu s ponukou
  34. // @description:sr Брзо, аутоматски безбедно и најлакше за конфигурисање са менијем
  35. // @description:sv Snabb, Auto Säker Och Enklast Att Konfigurera Med Meny
  36. // @description:th รวดเร็ว, ปลอดภัยอัตโนมัติและง่ายที่สุดในการกำหนดค่าด้วยเมนู
  37. // @description:tr Hızlı, Oto Korumalı Ve Kolay Ayarlanılabilir Menü
  38. // @description:uk Швидко, автоматично захищено та найлегше настроюване з меню
  39. // @description:ug تېز، ئاپتوماتىك سىغىنىش ۋە مەنىيى بىلەن ئۆزگىچە تەڭشەيدۇ
  40. // @description:vi Nhanh, Tự Động Bảo Mật Và Dễ Dàng Cấu Hình Với Menu
  41. // @description:zh-CN 快速、自动安全且易于配置的菜单
  42. // @description:zh-TW 快速、自動安全且易於配置的菜單
  43. // @author @ngixl
  44. // @match https://pixelplace.io/*
  45. // @exclude https://pixelplace.io/forums*
  46. // @exclude https://pixelplace.io/blog*
  47. // @exclude https://pixelplace.io/api*
  48. // @exclude https://pixelplace.io/gold-chart.php
  49. // @license MIT
  50. // @icon https://r.resimlink.com/aB5DPLiTFk.png
  51. // @run-at document-start
  52. // @grant unsafeWindow
  53. // @grant GM.info
  54. // @require https://gf.qytechs.cn/scripts/461063-mxo-li-brary/code/MXO%20L%C4%B0BRARY.js
  55. // @require https://gf.qytechs.cn/scripts/461221-mxobot-hacktimer-js-by-turuslan/code/MxoBot%20HackTimerjs%20By%20Turuslan.js
  56. // ==/UserScript==
  57.  
  58. // ==Locales==
  59. const lang = (navigator.language || navigator.userLanguage) == "tr" ? 1 : 0;
  60. const i18n = {
  61. setting: ["Bot Settings", "Bot Ayarları"][lang],
  62. load: ["Load image", "Resim"][lang],
  63. loaded: ["Loaded", "Yüklendi"][lang],
  64. nloaded: ["Not Loaded", "Yüklenmedi"][lang],
  65. nset: ["Not Set", "Ayarlanmadı"][lang],
  66. on: ["On", "Açık"][lang],
  67. off: ["Off", "Kapalı"][lang],
  68. protect: ["Protect", "Koruma"][lang],
  69. coordinate: ["Coordinate", "Koordinat"][lang],
  70. strategy: ["Shape", "Şekil"][lang],
  71. horizontal: ["Horizontal", "Yatay"][lang],
  72. vertical: ["Vertical", "Dikey"][lang],
  73. circular: ["Circular", "Dairesel"][lang],
  74. chess: ["Chess", "Dama"][lang],
  75. random: ["Random", "Rastgele"][lang],
  76. experimental: ["Experimental", "Deneysel"][lang],
  77. diagonal: ["Diagonal","Diyagonal"][lang],
  78. zigzag: ["Zigzag","Zikzaklı"][lang],
  79. baklava: ["Baklava","Baklava"][lang],
  80. archimedian: ["Archimedian","Arşimet "][lang],
  81. logarithmic: ["Logarithmic","Logaritmik "][lang],
  82. console: ["Mxo Console", "Mxo Konsolu"][lang],
  83. resizer: ["Resizer", "Boyut"][lang],
  84. brave_warning: ["Please do not use MxoBot with Brave Browser. Brave Browser can modify image R,G,B values which can result to MxoBot skipping pixels. MxoBot is compatible with Firefox, Edge and Chrome browsers.",
  85. "Lütfen Brave Browser kullanma. Brave Browser resminin R,G,B değerlerini değiştirir, bu da botun bazı pixelleri atlamasına neden olabilir. MxoBot Firefox, Edge ve Chrome tarayıcılarıyla kullanabilirsin."][lang],
  86. };
  87.  
  88.  
  89.  
  90. // ==/Locales==
  91.  
  92. // ==Brave Browser Check==
  93. async function checkBrave() {
  94. if (navigator.brave && await navigator.brave.isBrave()) {
  95. alert(i18n.brave_warning);
  96. }
  97. }
  98. checkBrave();
  99. // ==/Brave Browser Check==
  100.  
  101. // ==Config==
  102. const MXOBOT_EXPERIMENTAL_USE_MULTI_ACC = false;
  103. const MXOBOT_EXPERIMENTAL_STORE_LOADED_IMAGES = false;
  104. const MXOBOT_EXPERIMENTAL_SAVE_LAST_BOTTING = false;
  105. const MXOBOT_ANIMATE_BOT_CANVAS = true;
  106. const MXOBOT_CHECK_MAP_DYNAMICALLY = false;
  107. const MXOBOT_DO_NOT_DITHER = false;
  108. // const MXOBOT_DEBUG_MODE = false;
  109. const MXOBOT_TIMEOUT = 20;
  110. const MXOBOT_IMG_NOT_LOADED = "https://r.resimlink.com/aB5DPLiTFk.png";
  111. const MXOBOT_BOT_TITLE_IMG = "https://r.resimlink.com/L2UqxHdOsK-F.png";
  112. const MXOBOT_FONT =
  113. "https://gofile.io/d/Lm3pHQ";
  114. const MXOBOT_DRAWING_STYLES = [
  115. [i18n.horizontal, (a, b) => a[0] + a[1] * 0xfffff - b[0] - b[1] * 0xfffff],
  116. [i18n.vertical, (a, b) => a[0] * 0xfffff + a[1] - b[0] * 0xfffff - b[1]],
  117. [
  118. i18n.circular,
  119. function (a, b) {
  120. const origx = coordinates[0] + ~~(nimage.image.width >> 1);
  121. const origy = coordinates[1] + ~~(nimage.image.height >> 1);
  122. return (
  123. (a[0] - origx) ** 2 +
  124. (a[1] - origy) ** 2 -
  125. (b[0] - origx) ** 2 -
  126. (b[1] - origy) ** 2
  127. );
  128. },
  129. ],
  130. [i18n.chess, (a, b) => ((a[0] + a[1]) % 2) - ((b[0] + b[1]) % 2)],
  131. [i18n.random, () => 1 - Math.random() * 2],
  132. [
  133. i18n.experimental,
  134. function (a, b) {
  135. const origx = coordinates[0] + ~~(nimage.image.width >> 1);
  136. const origy = coordinates[1] + ~~(nimage.image.height >> 1);
  137. function calc(x) {
  138. unsafeWindow.calc =
  139. unsafeWindow.calc ||
  140. function (x) {
  141. return Math.abs(x[0] - origx) ** 3 + Math.abs(x[1] - origy) ** 3;
  142. };
  143. return unsafeWindow.calc(x);
  144. }
  145. return calc(a) - calc(b);
  146. },
  147. ],
  148. [
  149. i18n.diagonal,
  150. (pixel1, pixel2) => pixel1[0] - pixel2[0] + (pixel1[1] - pixel2[1]),
  151. ],
  152. [
  153. i18n.zigzag,
  154. (pixel1, pixel2) =>
  155. (pixel1[0] + pixel1[1]) % 2 === (pixel2[0] + pixel2[1]) % 2
  156. ? pixel1[0] - pixel2[0]
  157. : -(pixel1[0] - pixel2[0]),
  158. ],
  159. [
  160. i18n.baklava,
  161. (pixel1, pixel2) => {
  162. var centerX = coordinates[0] + ~~(nimage.image.width >> 1);
  163. var centerY = coordinates[1] + ~~(nimage.image.height >> 1);
  164. return (
  165. (Math.abs(pixel1[0] - centerX) + Math.abs(pixel1[1] - centerY)) *
  166. (1 +
  167. 0.1 *
  168. Math.cos(Math.atan2(pixel1[1] - centerY, pixel1[0] - centerX))) -
  169. (Math.abs(pixel2[0] - centerX) + Math.abs(pixel2[1] - centerY)) *
  170. (1 +
  171. 0.1 *
  172. Math.cos(Math.atan2(pixel2[1] - centerY, pixel2[0] - centerX)))
  173. );
  174. },
  175. ],
  176. [
  177. i18n.archimedian,
  178. (pixel1, pixel2) => {
  179. var centerX = coordinates[0] + ~~(nimage.image.width >> 1);
  180. var centerY = coordinates[1] + ~~(nimage.image.height >> 1);
  181. return (
  182. Math.sqrt((pixel1[0] - centerX) ** 2 + (pixel1[1] - centerY) ** 2) +
  183. Math.atan2(pixel1[1] - centerY, pixel1[0] - centerX) -
  184. (Math.sqrt((pixel2[0] - centerX) ** 2 + (pixel2[1] - centerY) ** 2) +
  185. Math.atan2(pixel2[1] - centerY, pixel2[0] - centerX))
  186. );
  187. },
  188. ],
  189. [
  190. i18n.logarithmic,
  191. (pixel1, pixel2) => {
  192. var centerX = coordinates[0] + ~~(nimage.image.width >> 1);
  193. var centerY = coordinates[1] + ~~(nimage.image.height >> 1);
  194. return (
  195. Math.log(
  196. Math.sqrt((pixel1[0] - centerX) ** 2 + (pixel1[1] - centerY) ** 2)
  197. ) +
  198. Math.atan2(pixel1[1] - centerY, pixel1[0] - centerX) -
  199. (Math.log(
  200. Math.sqrt((pixel2[0] - centerX) ** 2 + (pixel2[1] - centerY) ** 2)
  201. ) +
  202. Math.atan2(pixel2[1] - centerY, pixel2[0] - centerX))
  203. );
  204. },
  205. ],
  206. ];
  207. // ==/Config==
  208.  
  209. // ==LibNevin==
  210. const core = new NevinCore({
  211. timeout: MXOBOT_TIMEOUT,
  212. multibot: MXOBOT_EXPERIMENTAL_USE_MULTI_ACC,
  213. });
  214. NevinLogger.LEVEL = NevinLoggerFactory.LEVEL_INFO;
  215. // ==/LibNevin==
  216.  
  217. // ==MXObot UI==
  218. function draggable(element, draggable_element) {
  219. let x, y;
  220. // Handle the mousedown event
  221. // that's triggered when user drags the element
  222. const mouseDownHandler = function (e) {
  223. // Get the current mouse position
  224. x = e.clientX;
  225. y = e.clientY;
  226.  
  227. // Attach the listeners to `document`
  228. document.addEventListener("mousemove", mouseMoveHandler);
  229. document.addEventListener("mouseup", mouseUpHandler);
  230. };
  231.  
  232. const mouseMoveHandler = function (e) {
  233. // How far the mouse has been moved
  234. const dx = e.clientX - x;
  235. const dy = e.clientY - y;
  236.  
  237. // Set the position of element
  238. element.style.top = `${element.offsetTop + dy}px`;
  239. element.style.left = `${element.offsetLeft + dx}px`;
  240.  
  241. // Reassign the position of mouse
  242. x = e.clientX;
  243. y = e.clientY;
  244. };
  245.  
  246. const mouseUpHandler = function () {
  247. // Remove the handlers of `mousemove` and `mouseup`
  248. document.removeEventListener("mousemove", mouseMoveHandler);
  249. document.removeEventListener("mouseup", mouseUpHandler);
  250. };
  251.  
  252. draggable_element.addEventListener("mousedown", mouseDownHandler);
  253. }
  254.  
  255. const html = `
  256.  
  257.  
  258. <div>
  259. <div class="menu-div console" id="menu-console">
  260. <div class="menu-title" id="console-title">
  261. ${i18n.console}
  262. </div>
  263. <div class="menu-footer console-footer">
  264. </div>
  265. </div>
  266. <div class="menu-div" id="menu-div">
  267. <div class="menu-title" id="menu-title">
  268. Guilded.gg/Mxo
  269. </div>
  270. <img src="${MXOBOT_IMG_NOT_LOADED}" id="output">
  271. <div class="menu-footer" id="menu_footer">
  272. <div class="menu-alt-title">
  273. ${i18n.setting}
  274. </div>
  275. <div class="menu-property" id="load_image">
  276. <span class="menu-property-name">
  277. ${i18n.load}
  278. </span>
  279. <span class="menu-switch menu-red">
  280. ${i18n.nloaded}
  281. </span>
  282. </div>
  283. <div class="menu-property" id="bot_switch">
  284. <span class="menu-property-name">
  285. bot
  286. </span>
  287. <span class="menu-switch menu-red">
  288. ${i18n.off}
  289. </span>
  290. </div>
  291. <div class="menu-property" id="protect-switch" data-url="${"%68%74%74%70%73%3A%2F%2F%69%2E%69%6D%67%75%72%2E%63%6F%6D%2F%67%4C%61%7A%6F%51%67%2E%70%6E%67"}">
  292. <span class="menu-property-name">
  293. ${i18n.protect}
  294. </span>
  295. <span class="menu-switch menu-red">
  296. ${i18n.off}
  297. </span>
  298. </div>
  299. <div id="coordinate" class="menu-property" data-url="${
  300. GM.info.script.namespace
  301. }">
  302. <span class="menu-property-name">
  303. ${i18n.coordinate}
  304. </span>
  305. <span class="menu-switch menu-red" id="coordinate-text">
  306. ${i18n.nset}
  307. </span>
  308. <div class="menu-property" style="cursor:default;">
  309. <span class="menu-property-name">${i18n.strategy}</span>
  310. <select class="menu-property-name" id="strategy">
  311. ${MXOBOT_DRAWING_STYLES.map(function ([name, _]) {
  312. return "<option>" + name + "</option>";
  313. })}
  314. </select>
  315. </div>
  316. </div>
  317. </div>
  318. <style>
  319. @keyframes bababot_ui_blinker {
  320. 0% { opacity: .25; }
  321. 50% { opacity: .0; }
  322. 100% { opacity: .25; }
  323. }
  324. #strategy {
  325. font-family: "MXObot","Consolas";
  326. font-size: 16px;
  327. padding-left: 0px;
  328. }
  329. .bababot-ui-canvas {
  330. ${
  331. MXOBOT_ANIMATE_BOT_CANVAS
  332. ? "animation: bababot_ui_blinker 4s linear infinite;"
  333. : ""
  334. }
  335. position : absolute;
  336. pointer-events : none;
  337. opacity : 75%;
  338. outline : 1px solid transparent;
  339. image-rendering : crisp-edges;
  340. }
  341.  
  342. :root {
  343. --background-grey: #181818;
  344. --background-black: #121212;
  345. --shadow-black: #121212;
  346. --text-white: #DDDDDD;
  347. --text-gray: #ABABAB;
  348. --text-green: #03DD03;
  349. --text-red: #DD0303;
  350. --hover-gray: #252525;
  351. --border-black: #000000;
  352. }
  353.  
  354. @font-face {
  355. font-family: "MXObot";
  356. src: url('${MXOBOT_FONT}') format('woff');
  357. font-weight: normal;
  358. font-style: normal;
  359. font-display: swap;
  360. }
  361.  
  362. .menu-div {
  363. position: absolute;
  364. z-index: 1000;
  365. border: 1px solid var(--border-black);
  366. top: 10px;
  367. left: 150px;
  368. min-width: 200px;
  369. min-height: 150px;
  370. font-family: "MXObot", "Consolas";
  371. font-size: 8;
  372. text-shadow: 1px 1px black;
  373. background-color: var(--background-grey);
  374. color: var(--text-white);
  375. padding-top: 3px 2px 3px 2px;
  376. user-select: none;
  377. }
  378.  
  379.  
  380. .menu-title {
  381. border: 1px solid var(--border-black);
  382. padding: 2px;
  383. background-color: var(--background-black);
  384. background-image: url(${MXOBOT_BOT_TITLE_IMG});
  385. color: white;
  386. text-align: center;
  387. }
  388.  
  389. .menu-alt-title {
  390. padding-left: 3px;
  391. }
  392. .menu-property-name {
  393. padding-left: 7px;
  394. color: var(--text-gray);
  395. }
  396. .menu-red {
  397. color: var(--text-red);
  398. }
  399. .menu-green {
  400. color: var(--text-green);
  401. }
  402. .menu-property {
  403. cursor: pointer;
  404. width: 200px;
  405. }
  406. .menu-footer :hover {
  407. background-color: var(--hover-gray);
  408. }
  409. .menu-div img {
  410. display: block;
  411. margin: auto;
  412. width: 30px;
  413. border: 2px solid black;
  414. image-rendering: pixelated;
  415. }
  416. </style>
  417. </div>`;
  418.  
  419.  
  420. /*
  421.  
  422. Resizer Beta Input
  423.  
  424. <div class="menu-property-name" id="size-image">
  425. <span class="menu-input">
  426. ${i18n.resizer}
  427. </span>
  428. <input type="text" id="ximageHeight" size="1" maxlength="3"/>
  429. ${"x"}
  430. <input type="text" id="ximageWidth" size="1" maxlength="3"/>
  431. <span id="mySpan" onclick="Register()"></span>
  432. </div>
  433.  
  434. */
  435.  
  436.  
  437. var before_messages = [];
  438.  
  439. NevinLogger.listeners.push(function (template, css, level, msg) {
  440. const div = document.createElement("div");
  441. div.textContent = `[NevinCore] ${level} : ${msg}`;
  442. div.className = "menu-property";
  443. div.setAttribute("style", css);
  444. if (mxobot_console_footer) {
  445. mxobot_console_footer.prepend(div);
  446. } else {
  447. before_messages.push(div);
  448. }
  449. });
  450. var menu = new DOMParser().parseFromString(html, "text/html").body.children[0];
  451.  
  452. var mxobot_console_div;
  453. var mxobot_console_title;
  454. var mxobot_console_footer;
  455. var mxobot_coordinates;
  456. var mxobot_coordinates_text;
  457. var mxobot_menu_div;
  458. var mxobot_menu_title;
  459. var mxobot_game_canvas;
  460. var mxobot_game_context;
  461. var mxobot_protect;
  462. var mxobot_load_image;
  463. var mxobot_id;
  464. var canvas;
  465. var pixelplace_painting_move;
  466. var pixelplace_coordinates;
  467.  
  468. function initVars() {
  469. console.log(menu)
  470. mxobot_console_title = menu.querySelector("#console-title");
  471. mxobot_console_div = menu.querySelector("#menu-console");
  472. mxobot_coordinates = menu.querySelector("#coordinate");
  473. mxobot_coordinates_text = menu.querySelector("#coordinate-text");
  474. mxobot_menu_div = menu.querySelector("#menu-div");
  475. mxobot_menu_title = menu.querySelector("#menu-title");
  476. mxobot_protect = menu.querySelector("#protect-switch");
  477. mxobot_load_image = menu.querySelector("#load_image");
  478. mxobot_id = GM.info.namespace;
  479. mxobot_console_footer = menu.querySelector(".console-footer");
  480. pixelplace_coordinates = document.querySelector("#coordinates");
  481. pixelplace_painting_move = document.querySelector("#painting-move");
  482. canvas = document.querySelector("#canvas");
  483. }
  484.  
  485. function createBotCanvas() {
  486. mxobot_game_canvas = document.createElement("canvas");
  487. mxobot_game_canvas.width = canvas.width;
  488. mxobot_game_canvas.height = canvas.height;
  489. mxobot_game_context = mxobot_game_canvas.getContext("2d");
  490. mxobot_game_canvas.className = "bababot-ui-canvas";
  491. pixelplace_painting_move.prepend(mxobot_game_canvas);
  492. }
  493.  
  494. function loadConsole() {
  495. before_messages.forEach(function (div) {
  496. mxobot_console_footer.prepend(div);
  497. });
  498. before_messages = null;
  499. }
  500.  
  501. function controlProperty(id, callback) {
  502. const menu_property = document.getElementById(id);
  503. const span_state = menu_property.children[1];
  504. const refreshDOM = function () {
  505. var _state = span_state.textContent == i18n.off;
  506. span_state.textContent = _state ? i18n.on : i18n.off;
  507. span_state.setAttribute("class", _state ? "menu-green" : "menu-red");
  508. };
  509. menu_property.addEventListener("click", () => {
  510. refreshDOM();
  511. var _state = span_state.textContent == i18n.on;
  512. callback(_state);
  513. });
  514. refreshDOM();
  515. }
  516.  
  517. function clearMxobotCanvas() {
  518. mxobot_game_context.clearRect(
  519. 0,
  520. 0,
  521. mxobot_game_canvas.width,
  522. mxobot_game_canvas.height
  523. );
  524. }
  525.  
  526. async function Mxobot_UIMain() {
  527. document.body.prepend(menu);
  528. await NevinWaitForElm("#menu-div");
  529. await NevinWaitForElm("#canvas");
  530. initVars();
  531. createBotCanvas();
  532. loadConsole();
  533. draggable(mxobot_console_div, mxobot_console_title);
  534. draggable(mxobot_menu_div, mxobot_menu_title);
  535. }
  536.  
  537. // ==/Mxoot UI==
  538.  
  539. // ==Mxobot Javascript==
  540. var nimage;
  541. var coordinates;
  542.  
  543. async function Mxobot_JSMain() {
  544. if (MXOBOT_DO_NOT_DITHER) unsafeWindow.MXOBOT_DO_NOT_DITHER = true;
  545. unsafeWindow.core = core;
  546. core.protection = null;
  547. var protection_state = false;
  548. var drawing_style = MXOBOT_DRAWING_STYLES[0][1];
  549. function drawingStyleChange(e) {
  550. const index = e.srcElement.selectedIndex;
  551. if (index >= MXOBOT_DRAWING_STYLES.length) {
  552. NevinLogger.error(
  553. "Drawing style options have been tampered, resulting in an unsafe indexing of drawing styles. (Options length is smaller than the current index)"
  554. );
  555. }
  556. drawing_style = MXOBOT_DRAWING_STYLES[index][1];
  557. core.engine.tasks.sort(drawing_style);
  558. }
  559. document
  560. .getElementById("strategy")
  561. .addEventListener("change", drawingStyleChange);
  562. controlProperty("bot_switch", function (state) {
  563. console.log(nimage);
  564. if (!nimage) {
  565. NevinLogger.info("Image not loaded!");
  566. return;
  567. }
  568. if (!state) {
  569. clearMxobotCanvas();
  570. core.engine.tasks = [];
  571. core.protection?.stop();
  572. return;
  573. }
  574. if (!nimage || !nimage.image.complete) {
  575. core.logger.error("Image not loaded (yet?)");
  576. }
  577. clearMxobotCanvas();
  578. mxobot_game_context.drawImage(nimage.image, ...coordinates);
  579. core.engine.tasks = [
  580. ...core.engine.tasks,
  581. ...nimage.convertToTasks(...coordinates, core.nevinWS),
  582. ].sort(drawing_style);
  583. if (protection_state) {
  584. core.protection.load(nimage, coordinates);
  585. core.protection.start();
  586. }
  587. });
  588.  
  589. function loadImage(img) {
  590. nimage = img;
  591. nimage.image.addEventListener("load", function () {
  592. mxobot_load_image.children[1].textContent = i18n.loaded;
  593. mxobot_load_image.children[1].setAttribute("class", "menu-green");
  594. document.getElementById("output").src = nimage.image.src;
  595. if (coordinates) {
  596. clearMxobotCanvas();
  597. mxobot_game_context.drawImage(nimage.image, ...coordinates);
  598. }
  599. });
  600. }
  601.  
  602. mxobot_load_image.addEventListener("click", function () {
  603. core.picker.requestImageFromFileDialog(core.palette).then(loadImage);
  604. });
  605.  
  606. core.picker.addClipboardListener(core.palette, loadImage);
  607.  
  608. controlProperty("protect-switch", function (state) {
  609. protection_state = state;
  610. if (state) {
  611. if (!core.protection) {
  612. core.protection = new NevinProtect(core);
  613. if (coordinates && nimage) {
  614. core.protection.load(nimage, coordinates);
  615. }
  616. }
  617. core.protection.start();
  618. }
  619. });
  620.  
  621. canvas.addEventListener("click", function () {
  622. if (
  623. unescape(mxobot_protect.getAttribute("data-url")) !==
  624. mxobot_coordinates.getAttribute("data-url")
  625. ) {
  626. if (!this._opened) {
  627. this._opened = true;
  628. window.open(unescape(mxobot_protect.getAttribute("data-url")));
  629. }
  630. }
  631. coordinates = pixelplace_coordinates.textContent.split(",").map(Number);
  632. mxobot_coordinates_text.setAttribute("class", "menu-green");
  633. mxobot_coordinates_text.textContent = JSON.stringify(coordinates);
  634. if (nimage) {
  635. clearMxobotCanvas();
  636. mxobot_game_context.drawImage(nimage.image, ...coordinates);
  637. }
  638. });
  639. var oldTitle = document.title;
  640. setInterval(function () {
  641. if (!document.hasFocus()) {
  642. document.title = "Mxobot P" + core.engine.tasks.length;
  643. } else if (document.title.startsWith("Mxobot")) {
  644. document.title = oldTitle;
  645. }
  646. }, 10);
  647. }
  648.  
  649. async function Mxobot_Main() {
  650. await Mxobot_UIMain();
  651. await Mxobot_JSMain();
  652. }
  653.  
  654. (function () {
  655. var observer = new MutationObserver(function () {
  656. if (document.body) {
  657. Mxobot_Main();
  658. observer.disconnect();
  659. }
  660. });
  661. observer.observe(document.documentElement, { childList: true });
  662. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址