PP-Client

Pixel Place Client

  1. // ==UserScript==
  2. // @name PP-Client
  3. // @name:ru PP-Client
  4. // @description Pixel Place Client
  5. // @description:ru Pixel Place Клиент
  6. // @version 1.6.2.1
  7. // @author 0vC4
  8. // @namespace https://gf.qytechs.cn/users/670183
  9. // @match https://pixelplace.io/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
  11. // @license MIT
  12. // @grant none
  13. // @run-at document-start
  14. // @require https://gf.qytechs.cn/scripts/445776-ppab/code/PPAB.js?version=1056000
  15. // @require https://gf.qytechs.cn/scripts/438620-workertimer/code/WorkerTimer.js?version=1009025
  16. // @require https://gf.qytechs.cn/scripts/438408-cwss/code/CWSS.js?version=1042744
  17. // @require https://gf.qytechs.cn/scripts/444949-ppconf/code/PPConf.js?version=1050254
  18. // @require https://gf.qytechs.cn/scripts/443803-ppml/code/PPML.js?version=1050258
  19. // @require https://gf.qytechs.cn/scripts/443894-ppil/code/PPIL.js?version=1050256
  20. // @require https://gf.qytechs.cn/scripts/443807-ppt/code/PPT.js?version=1050374
  21. // @require https://gf.qytechs.cn/scripts/443844-ppcc/code/PPCC.js?version=1050358
  22. // @require https://gf.qytechs.cn/scripts/443907-pppc/code/PPPC.js?version=1050383
  23. // ==/UserScript==
  24. Object.defineProperty(window.console, 'log', {configurable:false,enumerable:true,writable:false,value:console.log});
  25. Object.defineProperty(window, 'setInterval', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.setInterval});
  26. Object.defineProperty(window, 'clearInterval', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.clearInterval});
  27. Object.defineProperty(window, 'setTimeout', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.setTimeout});
  28. Object.defineProperty(window, 'clearTimeout', {configurable:false,enumerable:true,writable:false,value:WorkerTimer.clearTimeout});
  29. setInterval(() => {
  30. const _18 = document.querySelector('[data-id="alert"]');
  31. if (!_18 || _18.style.display != 'flex') return;
  32. document.querySelector('.nsfw-continue').click();
  33. });
  34. (() => {
  35. const PPClient = window.PPClient || {modules:{}};
  36. window.PPClient = PPClient;
  37. PPClient.CWSS = CWSS;
  38. const {ImageLoader, Tools} = PPClient.modules;
  39. const config = PPClient.config;
  40. config.timer = WorkerTimer;
  41. config.packetSpeed = 30;
  42. config.subscribe(...Object.values(PPClient.modules).map(({config}) => config).filter(Boolean));
  43. PPClient.modules.Compiler.compile();
  44. Object.defineProperty(PPClient, 'ignore', {enumerable:true,configurable:true,get(){
  45. let b = !PPClient.ws.ignore;
  46. PPClient.sockets.map(ws=>ws.ignore = b);
  47. return b;
  48. },set(v){
  49. PPClient.sockets.map(ws=>ws.ignore = v);
  50. return v;
  51. }});
  52. PPClient.order = new Proxy({}, {
  53. get(_, type) {
  54. PPClient.config.order = type;
  55. return Tools.order[type]
  56. .finish(queue => {
  57. PPClient.pos = 0;
  58. PPClient.queue = queue;
  59. console.log('order finished');
  60. })
  61. .center([PPClient.map.width/2, PPClient.map.height/2])
  62. .silent(PPClient.config.silent)
  63. .start(PPClient.queue);
  64. }
  65. });
  66. PPClient.mode = mode => {
  67. if (mode == 'none') {
  68. PPClient.onclick = () => true;
  69. return true;
  70. }
  71. if (mode == 'rainbow_hole_v2') {
  72. PPClient.onclick = (x,y,pixel) => {
  73. const {width, height} = PPClient.map;
  74. const {palette, zero} = Tools.args;
  75. let clr = 0;
  76. let perc = null;
  77. Tools.shader
  78. .tick((x,y,p) => {
  79. const dx = (x/4-width/8)**2;
  80. const dy = (y-height/2)**2;
  81. const dist = (dx+dy)**.75;
  82. const percent = 1000*dist/(height/2)>>0;
  83. if (percent != perc) {
  84. perc = percent;
  85. clr = perc%palette.length;
  86. while (palette[clr] == zero) {
  87. clr++;
  88. if (clr > palette.length-1) clr = 0;
  89. }
  90. }
  91. PPClient.set(x, y, clr);
  92. })
  93. .finish((taskId) => {
  94. console.log('shader finished');
  95. Tools.order[config.order]
  96. .finish(queue => {
  97. PPClient.pos = 0;
  98. PPClient.queue = queue;
  99. console.log('order finished');
  100. })
  101. .silent(PPClient.config.silent)
  102. .center([width/2, height/2])
  103. .start(PPClient.queue);
  104. })
  105. .start(PPClient.map);
  106. return false;
  107. };
  108. return true;
  109. }
  110. if (mode == 'rainbow_hole') {
  111. PPClient.onclick = (x,y,pixel) => {
  112. const {width, height} = PPClient.map;
  113. const {palette, zero} = Tools.args;
  114. let clr = 0;
  115. let perc = null;
  116. Tools.shader
  117. .tick((x,y,p) => {
  118. const dist = ((x-width/2)**2+(y-height/2)**2)**0.5;
  119. const percent = 1000*dist/(height/2)>>0;
  120. if (percent != perc) {
  121. perc = percent;
  122. clr = perc%palette.length;
  123. while (palette[clr] == zero) {
  124. clr++;
  125. if (clr > palette.length-1) clr = 0;
  126. }
  127. }
  128. PPClient.set(x, y, clr);
  129. })
  130. .finish((taskId) => {
  131. console.log('shader finished');
  132. Tools.order[config.order]
  133. .finish(queue => {
  134. PPClient.pos = 0;
  135. PPClient.queue = queue;
  136. console.log('order finished');
  137. })
  138. .silent(PPClient.config.silent)
  139. .center([width/2, height/2])
  140. .start(PPClient.queue);
  141. })
  142. .start(PPClient.map);
  143. return false;
  144. };
  145. return true;
  146. }
  147. if (mode == 'border_rainbow') {
  148. PPClient.onclick = (x,y,pixel) => {
  149. const areaSize = 5;
  150. const has = areaSize>>1;
  151. const padding = 2;
  152. const {width, height, pixels} = PPClient.map;
  153. Tools.shader
  154. .tick((x,y,p) => {
  155. if (x < areaSize || x > width-1-areaSize || y < areaSize || y > height-1-areaSize) return;
  156. let start = (x-has)+(y-has)*width;
  157. let area = [];
  158. for (let i = 0; i < areaSize; i++) {
  159. const offset = start+i*width;
  160. area.push(...pixels.slice(offset, offset+areaSize));
  161. }
  162. if (area.find(p => p === 255)) {
  163. PPClient.set(x, y, Tools.wheel);
  164. return;
  165. }
  166. const size = areaSize+padding*2;
  167. const hs = has+padding;
  168. if (x < size || x > width-1-size || y < size || y > height-1-size) return;
  169. start = (x-hs)+(y-hs)*width;
  170. area = [];
  171. for (let i = 0; i < size; i++) {
  172. const offset = start+i*width;
  173. area.push(...pixels.slice(offset, offset+size));
  174. }
  175. if (area.find(p => p === 255)) {
  176. PPClient.set(x, y, 5);
  177. return;
  178. }
  179. PPClient.set(x, y, 5);
  180. })
  181. .finish((taskId) => {
  182. console.log('shader finished');
  183. Tools.order[config.order]
  184. .finish(queue => {
  185. PPClient.pos = 0;
  186. PPClient.queue = queue;
  187. console.log('order finished');
  188. })
  189. .silent(PPClient.config.silent)
  190. .center([width/2, height/2])
  191. .start(PPClient.queue);
  192. })
  193. .start(PPClient.map);
  194. return false;
  195. };
  196. return true;
  197. }
  198. if (mode == 'image') {
  199. PPClient.onclick = (x,y,pixel) => {
  200. ImageLoader.loadImage
  201. .finish(([pixels, w, h]) => {
  202. if (config.order == 'fromCenter') x -= w/2>>0;
  203. if (config.order == 'fromCenter') y -= h/2>>0;
  204. Tools.image
  205. .tick((x,y,p) => {
  206. if (!(x>=0&&y>=0&&x<PPClient.map.width&&y<PPClient.map.height)) return;
  207. PPClient.set(x, y, p);
  208. })
  209. .finish((taskId) => {
  210. console.log('image finished');
  211. Tools.order[config.order]
  212. .finish(queue => {
  213. PPClient.pos = 0;
  214. PPClient.queue = queue;
  215. console.log('order finished');
  216. })
  217. .silent(PPClient.config.silent)
  218. .center([x+w/2, y+h/2])
  219. .start(PPClient.queue);
  220. })
  221. .start(pixels, x,y,w,h);
  222. }).start();
  223. return false;
  224. };
  225. return true;
  226. }
  227. };
  228. PPClient.lock = true;
  229. PPClient.mode('image');
  230. })();
  231. // 0vC4#7152 aka Palette

QingJ © 2025

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