MyBot

MyBot Beta

目前为 2023-11-05 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name MyBot
  3. // @description MyBot Beta
  4. // @version 1.7
  5. // @author SamaelWired
  6. // @namespace https://gf.qytechs.cn/users/976572
  7. // @match https://pixelplace.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
  9. // @license MIT
  10. // @grant none
  11. // @run-at document-start
  12. // @require https://gf.qytechs.cn/scripts/479121-mybot/code/MyBot.js?version=1275783
  13. // @require https://gf.qytechs.cn/scripts/479122-mybot-workertimer/code/MyBot%20WorkerTimer.js?version=1275782
  14. // @require https://gf.qytechs.cn/scripts/479125-mybot-cwss/code/MyBot%20CWSS.js?version=1275785
  15. // @require https://gf.qytechs.cn/scripts/479127-mybot-newcolors/code/MyBot%20NewColors.js?version=1275788
  16. // @require https://gf.qytechs.cn/scripts/479128-mybot-maploader/code/MyBot%20MapLoader.js?version=1275793
  17. // @require https://gf.qytechs.cn/scripts/479129-mybot-imageloader/code/MyBot%20ImageLoader.js?version=1275794
  18. // @require https://gf.qytechs.cn/scripts/479130-mybot-tools/code/MyBot%20Tools.js?version=1275795
  19. // @require https://gf.qytechs.cn/scripts/479131-mybot-compiler/code/MyBot%20Compiler.js?version=1275798
  20. // @require https://gf.qytechs.cn/scripts/479132-mybot-parallel-connections/code/MyBot%20Parallel%20Connections.js?version=1275800
  21. // ==/UserScript==
  22. Object.defineProperty(window.console, 'log', {configurable:false,enumerable:true,writable:false,value:console.log});
  23. Object.defineProperty(window, 'setInterval', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.setInterval});
  24. Object.defineProperty(window, 'clearInterval', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.clearInterval});
  25. Object.defineProperty(window, 'setTimeout', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.setTimeout});
  26. Object.defineProperty(window, 'clearTimeout', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.clearTimeout});
  27. setInterval(() => {
  28. const _18 = document.querySelector('[data-id="alert"]');
  29. if (!_18 || _18.style.display != 'flex') return;
  30. document.querySelector('.nsfw-continue').click();
  31. });
  32. (() => {
  33. const MyBot = window.MyBot || {modules:{}};
  34. window.MyBot = MyBot;
  35. MyBot.CWSS = CWSS;
  36.  
  37. const {ImageLoader, Tools} = MyBot.modules;
  38. const config = MyBot.config;
  39.  
  40. config.timer = WorkerTimer;
  41. config.packetSpeed = 45;
  42. config.subscribe(...Object.values(MyBot.modules).map(({config}) => config).filter(Boolean));
  43. MyBot.modules.Compiler.compile();
  44.  
  45. Object.defineProperty(MyBot, 'ignore', {enumerable:true,configurable:true,get(){
  46. let b = !MyBot.ws.ignore;
  47. MyBot.sockets.map(ws=>ws.ignore = b);
  48. return b;
  49. },set(v){
  50. MyBot.sockets.map(ws=>ws.ignore = v);
  51. return v;
  52. }});
  53.  
  54. MyBot.order = new Proxy({}, {
  55. get(_, type) {
  56. MyBot.config.order = type;
  57. return Tools.order[type]
  58. .finish(queue => {
  59. MyBot.pos = 0;
  60. MyBot.queue = queue;
  61. console.log('order finished');
  62. })
  63. .center([MyBot.map.width/2, MyBot.map.height/2])
  64. .silent(MyBot.config.silent)
  65. .start(MyBot.queue);
  66. }
  67. });
  68.  
  69. MyBot.mode = mode => {
  70. if (mode == 'none') {
  71. MyBot.onclick = () => true;
  72. return true;
  73. }
  74.  
  75. if (mode == 'rainbow_hole_v2') {
  76. MyBot.onclick = (x,y,pixel) => {
  77. const {width, height} = MyBot.map;
  78. const {palette, zero} = Tools.args;
  79.  
  80. let clr = 0;
  81. let perc = null;
  82.  
  83. Tools.shader
  84. .tick((x,y,p) => {
  85. const dx = (x/4-width/8)**2;
  86. const dy = (y-height/2)**2;
  87. const dist = (dx+dy)**.75;
  88.  
  89. const percent = 1000*dist/(height/2)>>0;
  90. if (percent != perc) {
  91. perc = percent;
  92. clr = perc%palette.length;
  93. while (palette[clr] == zero) {
  94. clr++;
  95. if (clr > palette.length-1) clr = 0;
  96. }
  97. }
  98.  
  99. MyBot.set(x, y, clr);
  100. })
  101. .finish((taskId) => {
  102. console.log('shader finished');
  103. Tools.order[config.order]
  104. .finish(queue => {
  105. MyBot.pos = 0;
  106. MyBot.queue = queue;
  107. console.log('order finished');
  108. })
  109. .silent(MyBot.config.silent)
  110. .center([width/2, height/2])
  111. .start(MyBot.queue);
  112. })
  113. .start(MyBot.map);
  114.  
  115. return false;
  116. };
  117. return true;
  118. }
  119.  
  120. if (mode == 'rainbow_hole') {
  121. MyBot.onclick = (x,y,pixel) => {
  122. const {width, height} = MyBot.map;
  123. const {palette, zero} = Tools.args;
  124.  
  125. let clr = 0;
  126. let perc = null;
  127.  
  128. Tools.shader
  129. .tick((x,y,p) => {
  130. const dist = ((x-width/2)**2+(y-height/2)**2)**0.5;
  131. const percent = 1000*dist/(height/2)>>0;
  132. if (percent != perc) {
  133. perc = percent;
  134. clr = perc%palette.length;
  135. while (palette[clr] == zero) {
  136. clr++;
  137. if (clr > palette.length-1) clr = 0;
  138. }
  139. }
  140. MyBot.set(x, y, clr);
  141. })
  142. .finish((taskId) => {
  143. console.log('shader finished');
  144. Tools.order[config.order]
  145. .finish(queue => {
  146. MyBot.pos = 0;
  147. MyBot.queue = queue;
  148. console.log('order finished');
  149. })
  150. .silent(MyBot.config.silent)
  151. .center([width/2, height/2])
  152. .start(MyBot.queue);
  153. })
  154. .start(MyBot.map);
  155.  
  156. return false;
  157. };
  158. return true;
  159. }
  160.  
  161. if (mode == 'border_rainbow') {
  162. MyBot.onclick = (x,y,pixel) => {
  163. const areaSize = 5;
  164. const has = areaSize>>1;
  165. const padding = 2;
  166. const {width, height, pixels} = MyBot.map;
  167.  
  168. Tools.shader
  169. .tick((x,y,p) => {
  170. if (x < areaSize || x > width-1-areaSize || y < areaSize || y > height-1-areaSize) return;
  171.  
  172. let start = (x-has)+(y-has)*width;
  173. let area = [];
  174. for (let i = 0; i < areaSize; i++) {
  175. const offset = start+i*width;
  176. area.push(...pixels.slice(offset, offset+areaSize));
  177. }
  178.  
  179. if (area.find(p => p === 255)) {
  180. MyBot.set(x, y, Tools.wheel);
  181. return;
  182. }
  183.  
  184. const size = areaSize+padding*2;
  185. const hs = has+padding;
  186.  
  187. if (x < size || x > width-1-size || y < size || y > height-1-size) return;
  188.  
  189. start = (x-hs)+(y-hs)*width;
  190. area = [];
  191. for (let i = 0; i < size; i++) {
  192. const offset = start+i*width;
  193. area.push(...pixels.slice(offset, offset+size));
  194. }
  195.  
  196. if (area.find(p => p === 255)) {
  197. MyBot.set(x, y, 5);
  198. return;
  199. }
  200.  
  201. MyBot.set(x, y, 5);
  202. })
  203. .finish((taskId) => {
  204. console.log('shader finished');
  205. Tools.order[config.order]
  206. .finish(queue => {
  207. MyBot.pos = 0;
  208. MyBot.queue = queue;
  209. console.log('order finished');
  210. })
  211. .silent(MyBot.config.silent)
  212. .center([width/2, height/2])
  213. .start(MyBot.queue);
  214. })
  215. .start(MyBot.map);
  216.  
  217. return false;
  218. };
  219. return true;
  220. }
  221.  
  222. if (mode == 'image') {
  223. MyBot.onclick = (x,y,pixel) => {
  224. ImageLoader.loadImage
  225. .finish(([pixels, w, h]) => {
  226. if (config.order == 'fromCenter') x -= w/2>>0;
  227. if (config.order == 'fromCenter') y -= h/2>>0;
  228.  
  229. Tools.image
  230. .tick((x,y,p) => {
  231. if (!(x>=0&&y>=0&&x<MyBot.map.width&&y<MyBot.map.height)) return;
  232. MyBot.set(x, y, p);
  233. })
  234. .finish((taskId) => {
  235. console.log('image finished');
  236. Tools.order[config.order]
  237. .finish(queue => {
  238. MyBot.pos = 0;
  239. MyBot.queue = queue;
  240. console.log('order finished');
  241. })
  242. .silent(MyBot.config.silent)
  243. .center([x+w/2, y+h/2])
  244. .start(MyBot.queue);
  245. })
  246. .start(pixels, x,y,w,h);
  247. }).start();
  248.  
  249. return false;
  250. };
  251. return true;
  252. }
  253. };
  254.  
  255. MyBot.lock = true;
  256. MyBot.mode('image');
  257. })();

QingJ © 2025

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