Sploop decorations

adds some visual stuff

  1. // ==UserScript==
  2. // @name Sploop decorations
  3. // @version 1.2
  4. // @description adds some visual stuff
  5. // @author nyanner
  6. // @match *://sploop.io/*
  7. // @match *://lostworld.io/*
  8. // @run-at document-start
  9. // @icon https://sploop.io/img/ui/favicon.png
  10. // @grant none
  11. // @namespace https://gf.qytechs.cn/users/960747
  12. // ==/UserScript==
  13.  
  14. (() => {
  15. "use strict";
  16. const TYPEOF = value => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
  17. const NumberSystem = [ {
  18. radix: 2,
  19. prefix: "0b0*"
  20. }, {
  21. radix: 8,
  22. prefix: "0+"
  23. }, {
  24. radix: 10,
  25. prefix: ""
  26. }, {
  27. radix: 16,
  28. prefix: "0x0*"
  29. } ];
  30. class Regex {
  31. constructor(code, unicode) {
  32. this.code = code;
  33. this.COPY_CODE = code;
  34. this.unicode = unicode || false;
  35. this.hooks = {};
  36. }
  37. static parseValue(value) {
  38. try {
  39. return Function(`return (${value})`)();
  40. } catch (err) {
  41. return null;
  42. }
  43. }
  44. isRegexp(value) {
  45. return TYPEOF(value) === "regexp";
  46. }
  47. generateNumberSystem(int) {
  48. const copy = [ ...NumberSystem ];
  49. const template = copy.map((({prefix, radix}) => prefix + int.toString(radix)));
  50. return `(?:${template.join("|")})`;
  51. }
  52. parseVariables(regex) {
  53. regex = regex.replace(/\{VAR\}/g, "(?:let|var|const)");
  54. regex = regex.replace(/\{QUOTE\}/g, "['\"`]");
  55. regex = regex.replace(/ARGS\{(\d+)\}/g, ((...args) => {
  56. let count = Number(args[1]), arr = [];
  57. while (count--) arr.push("\\w+");
  58. return arr.join("\\s*,\\s*");
  59. }));
  60. regex = regex.replace(/NUMBER\{(\d+)\}/g, ((...args) => {
  61. const int = Number(args[1]);
  62. return this.generateNumberSystem(int);
  63. }));
  64. return regex;
  65. }
  66. format(name, inputRegex, flags) {
  67. this.totalHooks += 1;
  68. let regex = "";
  69. if (Array.isArray(inputRegex)) {
  70. regex = inputRegex.map((exp => this.isRegexp(exp) ? exp.source : exp)).join("\\s*");
  71. } else if (this.isRegexp(inputRegex)) {
  72. regex = inputRegex.source;
  73. }
  74. regex = this.parseVariables(regex);
  75. if (this.unicode) {
  76. regex = regex.replace(/\\w/g, "(?:[^\\x00-\\x7F-]|\\$|\\w)");
  77. }
  78. const expression = new RegExp(regex.replace(/\{INSERT\}/, ""), flags);
  79. const match = this.code.match(expression);
  80. return regex.includes("{INSERT}") ? new RegExp(regex, flags) : expression;
  81. }
  82. template(type, name, regex, substr) {
  83. const expression = new RegExp(`(${this.format(name, regex).source})`);
  84. const match = this.code.match(expression) || [];
  85. this.code = this.code.replace(expression, type === 0 ? "$1" + substr : substr + "$1");
  86. return match;
  87. }
  88. match(name, regex, flags, debug = false) {
  89. const expression = this.format(name, regex, flags);
  90. const match = this.code.match(expression) || [];
  91. this.hooks[name] = {
  92. expression,
  93. match
  94. };
  95. return match;
  96. }
  97. matchAll(name, regex, debug = false) {
  98. const expression = this.format(name, regex, "g");
  99. const matches = [ ...this.code.matchAll(expression) ];
  100. this.hooks[name] = {
  101. expression,
  102. match: matches
  103. };
  104. return matches;
  105. }
  106. replace(name, regex, substr, flags) {
  107. const expression = this.format(name, regex, flags);
  108. this.code = this.code.replace(expression, substr);
  109. return this.code.match(expression) || [];
  110. }
  111. replaceAll(name, regex, substr, flags) {
  112. const expression = this.format(name, regex, "g");
  113. this.code = this.code.replaceAll(expression, substr);
  114. return this.code.match(expression) || [];
  115. }
  116. append(name, regex, substr) {
  117. return this.template(0, name, regex, substr);
  118. }
  119. prepend(name, regex, substr) {
  120. return this.template(1, name, regex, substr);
  121. }
  122. insert(name, regex, substr) {
  123. const {source} = this.format(name, regex);
  124. if (!source.includes("{INSERT}")) throw new Error("Your regexp must contain {INSERT} keyword");
  125. const findExpression = new RegExp(source.replace(/^(.*)\{INSERT\}(.*)$/, "($1)($2)"));
  126. this.code = this.code.replace(findExpression, `$1${substr}$2`);
  127. return this.code.match(findExpression);
  128. }
  129. }
  130. let Variables, decorations;
  131. const applyHooks = code => {
  132. const Hook = new Regex(code, true);
  133. window.COPY_CODE = (Hook.COPY_CODE.match(/^(\(function \w+\(\w+\)\{.+)\(.+?\);$/) || [])[1];
  134. Hook.append("EXTERNAL fix", /\(function (\w+)\(\w+\)\{/, "let $2 = eval(`(() => ${COPY_CODE})()`);delete window.COPY_CODE;");
  135. Hook.replace("fix", /\(function (\w+)\(\w+\)\{/, `(function snowvibe(){`);
  136. Hook.replace("fix", /"function"==typeof \w+&&\(\w+=\w\(\w+,\w+\)\);/, ``);
  137. const myData = Hook.match("myPlayer", /=(\w.get\(\w{2}\));\w&&\w\(\)/)[1];
  138. const X = Hook.match("playerX", /\{this\.(\w{2})=\w\|\|0/)[1];
  139. const Y = Hook.match("playerY", /,this\.(\w{2})=\w\|\|0\}/)[1];
  140. const ID = Hook.match("ID", /&&\w{2}===\w\.(\w{2})\){/)[1];
  141. const ID2 = Hook.match("ID2", /-1!==\w+\.(\w+)&&/)[1];
  142. const currentWeapon = Hook.match("crntWeapon", /,\w.(\w{2})===/)[1];
  143. const angle = Hook.match("angle", /;\w.(\w{2})=\w\(\)/)[1];
  144. const weaponName = Hook.match("wpnName", /(\w{2}):"XX/)[1];
  145. const health = Hook.match("health", /(\w{2})<<8;/)[1];
  146. const weaponDamage = Hook.match("wpnDamage", /(\w{2}):32,reload:300/)[1];
  147. const teamID = Hook.match("test", /,\w=\w.(\w{2})\|.+?\<\<8/)[1];
  148. const radius = Hook.match("radius", /(\w{2}):220/)[1];
  149. const [, currentItem, hat] = Hook.match("hat", /\(\w+\.(\w+)\|\w+\.(\w+)<<NUMBER{8}\)/);
  150. const size = Hook.match("size", /\.(\w{2})\+50/)[1];
  151. const inWhichObject = Hook.match("iwo", /110\).+?,1===\w.(\w{2})&&!\w{2}/)[1];
  152. const weaponID = Hook.match("el", /(\w{2}):0,\w{2}:22,reload:150/)[1];
  153. const itemType = Hook.matchAll("el", /,(\w+):9,\w+:2/)[1][1];
  154. const itemsID = Hook.match("IDs", />1\){.{3}(\w{2})/)[1];
  155. const itemBar = Hook.match("defaultData", /(\W\w+>NUMBER{1}\W.+?(\w+)\.(\w+).+?)function/)[3];
  156. const objCount = Hook.match("Quantity", /\),this.(\w{2})=\w\):/)[1];
  157. const weaponList = Hook.match("weaponList", /\?Math\.PI\/2.+?(\w\(\))/)[1];
  158. const isTyping = Hook.match("is typing", /=\+new Date,(\w{2})=!1,/)[1];
  159. const damageReduce = Hook.match("damage reduce value", /10,(\w{2}):\.75,/)[1];
  160. const [, animations, hitAngle, weaponAnimation, animationTime, animationSpeed, playAnimation] = Hook.match("weapon animations", /0,\w\.(\w{2})\.(\w{2})=.{4}(\w{2})\.(\w{2}).{6}(\w{2}).+?(\w{2})\(\.01/);
  161. const sortedEntities = Hook.match("entities", /,\w=0;\w=(\w)\[/)[1];
  162. const speedBuff = Hook.match("speed", /(\w+):1\.23/)[1];
  163. const weaponSpeedBuff = Hook.match("speed", /300,(\w+):\.85/)[1];
  164. const cam = Hook.match("cam", /,\w\)}},(\w{2})=new function/)[1];
  165. const ctx = Hook.match("ctx", /(\w{2})=\w{2}(\[\w\(\d{3}\)\]|\.getContext)\("2d"\),\w{2}/)[1];
  166. const [, camX, camY] = Hook.match("data", /height:20,(\w+).+?.(\w+)/);
  167. const [, biomeY, biomeHeight] = Hook.match("data", /\w{2}:160,(\w{2}):160,\w{2}.+?(\w{2}):/);
  168. const local = "window.storage";
  169. Hook.append("newImg", /(\w).{9}(.{9})."clan_decline"\)\);/, `\n $2[777] = $3("yFlower"));\n $2[777].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/yellowFlower.png?v=1714580473155";\n $2[666] = $3("rFlower"));\n $2[666].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/redFlower.png?v=1714579975791";\n $2[555] = $3("berry"));\n $2[555].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/zxc.png?v=1714581353965";\n $2[1000] = $3("bigEGG"));\n $2[1000].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/bigEGG.png?v=1714650054208";\n $2[999] = $3("miniEGG"));\n $2[999].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/miniEGGpng.png?v=1714650626845";\n $2[888] = $3("ybigEGG"));\n $2[888].src = "https://cdn.glitch.global/80f01abb-e90c-4a7c-8f06-4aab31fdf28a/ybigEGG.png?v=1714757303463";\n `);
  170. Hook.append("player id", /\((\w)\[0\]\){case \w+\(\).\w+.\w+:/, `${local}.myID = $2[1];`);
  171. const generatePositions = (amount, id) => {
  172. let flowers = [];
  173. for (let i = 0; i < amount; i++) {
  174. let obj = {
  175. [Variables.x]: Math.floor(Math.random() * (9800 - 200 + 1)) + 200,
  176. [Variables.y]: Math.floor(Math.random() * (7450 - 200 + 1)) + 200,
  177. id
  178. };
  179. flowers.push(obj);
  180. }
  181. return flowers;
  182. };
  183. Variables = {
  184. myPlayer: {
  185. myData,
  186. x: `${myData}.${X}`,
  187. y: `${myData}.${Y}`,
  188. id: `${myData}.${ID}`,
  189. teamID: `${myData}.${teamID}`,
  190. angle: `${myData}.${angle}`
  191. },
  192. x: X,
  193. y: Y,
  194. id: ID,
  195. id2: ID2,
  196. hat,
  197. size,
  198. camX,
  199. camY,
  200. type: "type",
  201. angle,
  202. biomeY,
  203. health,
  204. radius,
  205. teamID,
  206. itemsID,
  207. isTyping,
  208. weaponID,
  209. objCount,
  210. itemType,
  211. hitAngle,
  212. speedBuff,
  213. weaponList,
  214. weaponName,
  215. animations,
  216. biomeHeight,
  217. weaponDamage,
  218. damageReduce,
  219. playAnimation,
  220. inWhichObject,
  221. currentWeapon,
  222. animationTime,
  223. animationSpeed,
  224. weaponAnimation,
  225. weaponSpeedBuff
  226. };
  227. decorations = [ {
  228. id: 1e3,
  229. [Variables.x]: 29.99999999999999,
  230. [Variables.y]: 2550.0000000056198
  231. }, {
  232. id: 1e3,
  233. [Variables.x]: 214.0002966762103,
  234. [Variables.y]: 2492.0291726187397
  235. }, {
  236. id: 1e3,
  237. [Variables.x]: 382.0748870194689,
  238. [Variables.y]: 2440.6865700037215
  239. }, {
  240. id: 1e3,
  241. [Variables.x]: 573.9858511507157,
  242. [Variables.y]: 2503.996448203956
  243. }, {
  244. id: 1e3,
  245. [Variables.x]: 761.9999908462445,
  246. [Variables.y]: 2442.0386539633755
  247. }, {
  248. id: 1e3,
  249. [Variables.x]: 952.0590210896952,
  250. [Variables.y]: 2505.0498958190256
  251. }, {
  252. id: 1e3,
  253. [Variables.x]: 1259.9862437885706,
  254. [Variables.y]: 2452.0322384681695
  255. }, {
  256. id: 1e3,
  257. [Variables.x]: 1450.0232490356113,
  258. [Variables.y]: 2512.003077236567
  259. }, {
  260. id: 1e3,
  261. [Variables.x]: 1641.999998107236,
  262. [Variables.y]: 2447.999837480006
  263. }, {
  264. id: 1e3,
  265. [Variables.x]: 1764.0000434531719,
  266. [Variables.y]: 2505.0000611454825
  267. }, {
  268. id: 1e3,
  269. [Variables.x]: 1988.0000024140948,
  270. [Variables.y]: 2475.3910402273605
  271. }, {
  272. id: 1e3,
  273. [Variables.x]: 2179.999948255453,
  274. [Variables.y]: 2539.9980611367455
  275. }, {
  276. id: 1e3,
  277. [Variables.x]: 2371.000480338862,
  278. [Variables.y]: 2415.9959284149245
  279. }, {
  280. id: 1e3,
  281. [Variables.x]: 2498.0000070562905,
  282. [Variables.y]: 2536.0629494204723
  283. }, {
  284. id: 1e3,
  285. [Variables.x]: 2686.9998878301403,
  286. [Variables.y]: 2472.9999999978954
  287. }, {
  288. id: 1e3,
  289. [Variables.x]: 2925.999527997155,
  290. [Variables.y]: 2485.018991363512
  291. }, {
  292. id: 1e3,
  293. [Variables.x]: 3097.732209871221,
  294. [Variables.y]: 2439.997508765663
  295. }, {
  296. id: 1e3,
  297. [Variables.x]: 3273.968723799376,
  298. [Variables.y]: 2549.999193626759
  299. }, {
  300. id: 1e3,
  301. [Variables.x]: 3464.8013362358633,
  302. [Variables.y]: 2485.988137109807
  303. }, {
  304. id: 1e3,
  305. [Variables.x]: 3658.901643634054,
  306. [Variables.y]: 2485.9999999926995
  307. }, {
  308. id: 1e3,
  309. [Variables.x]: 3831.043036235859,
  310. [Variables.y]: 2526.0001627953843
  311. }, {
  312. id: 1e3,
  313. [Variables.x]: 4082.9596476709476,
  314. [Variables.y]: 2461.9236918125425
  315. }, {
  316. id: 1e3,
  317. [Variables.x]: 3956.0004172683734,
  318. [Variables.y]: 2461.99999999995
  319. }, {
  320. id: 1e3,
  321. [Variables.x]: 4277.747414095257,
  322. [Variables.y]: 2513.8991451561224
  323. }, {
  324. id: 1e3,
  325. [Variables.x]: 4509.000161954971,
  326. [Variables.y]: 2580.0064837158116
  327. }, {
  328. id: 1e3,
  329. [Variables.x]: 4400.0000005704605,
  330. [Variables.y]: 2479.9017377199107
  331. }, {
  332. id: 1e3,
  333. [Variables.x]: 4781.002734792941,
  334. [Variables.y]: 2488.1308565839
  335. }, {
  336. id: 1e3,
  337. [Variables.x]: 4967.00551941161,
  338. [Variables.y]: 2551.1279965524545
  339. }, {
  340. id: 1e3,
  341. [Variables.x]: 5160.050201842505,
  342. [Variables.y]: 2488.0470865591833
  343. }, {
  344. id: 1e3,
  345. [Variables.x]: 5352.999570332228,
  346. [Variables.y]: 2552.020740569861
  347. }, {
  348. id: 1e3,
  349. [Variables.x]: 5543.93781742945,
  350. [Variables.y]: 2488.0029731646046
  351. }, {
  352. id: 1e3,
  353. [Variables.x]: 5737.000002635433,
  354. [Variables.y]: 2427.172435813349
  355. }, {
  356. id: 1e3,
  357. [Variables.x]: 5928.993634014561,
  358. [Variables.y]: 2464.136863940179
  359. }, {
  360. id: 1e3,
  361. [Variables.x]: 6116.258412735068,
  362. [Variables.y]: 2460.7532317948144
  363. }, {
  364. id: 1e3,
  365. [Variables.x]: 6320.9560100313865,
  366. [Variables.y]: 2503.999997449834
  367. }, {
  368. id: 1e3,
  369. [Variables.x]: 6559.886115789101,
  370. [Variables.y]: 2497.8825216612922
  371. }, {
  372. id: 1e3,
  373. [Variables.x]: 6808.045482957361,
  374. [Variables.y]: 2434.7954508014664
  375. }, {
  376. id: 1e3,
  377. [Variables.x]: 6686.313048001445,
  378. [Variables.y]: 2434.000063238881
  379. }, {
  380. id: 1e3,
  381. [Variables.x]: 7007.821502411624,
  382. [Variables.y]: 2497.842353327186
  383. }, {
  384. id: 1e3,
  385. [Variables.x]: 7201.89346427579,
  386. [Variables.y]: 2434.814349475234
  387. }, {
  388. id: 1e3,
  389. [Variables.x]: 7394.0000069265125,
  390. [Variables.y]: 2496.000855023708
  391. }, {
  392. id: 1e3,
  393. [Variables.x]: 7586.991570724414,
  394. [Variables.y]: 2496.002150801967
  395. }, {
  396. id: 1e3,
  397. [Variables.x]: 7774.35475739181,
  398. [Variables.y]: 2433.97018813505
  399. }, {
  400. id: 1e3,
  401. [Variables.x]: 7965.652671373453,
  402. [Variables.y]: 2433.9999999745323
  403. }, {
  404. id: 1e3,
  405. [Variables.x]: 8105.065104471541,
  406. [Variables.y]: 2448.041779867961
  407. }, {
  408. id: 1e3,
  409. [Variables.x]: 8357.00328524934,
  410. [Variables.y]: 2485.986261225132
  411. }, {
  412. id: 1e3,
  413. [Variables.x]: 8500.999736983238,
  414. [Variables.y]: 2584.090122606014
  415. }, {
  416. id: 1e3,
  417. [Variables.x]: 8679.159237507823,
  418. [Variables.y]: 2413.199101719817
  419. }, {
  420. id: 1e3,
  421. [Variables.x]: 8908.11207669312,
  422. [Variables.y]: 2493.8815710969857
  423. }, {
  424. id: 1e3,
  425. [Variables.x]: 9100.266251022786,
  426. [Variables.y]: 2430.0089637733436
  427. }, {
  428. id: 1e3,
  429. [Variables.x]: 9286.056462091026,
  430. [Variables.y]: 2485.9780466880356
  431. }, {
  432. id: 1e3,
  433. [Variables.x]: 9538.995084609018,
  434. [Variables.y]: 2450.9396355931212
  435. }, {
  436. id: 1e3,
  437. [Variables.x]: 9732.002382560924,
  438. [Variables.y]: 2514.7415554647096
  439. }, {
  440. id: 1e3,
  441. [Variables.x]: 9924.06913400942,
  442. [Variables.y]: 2450.3753934720717
  443. }, {
  444. id: 999,
  445. [Variables.x]: 9633.066283895572,
  446. [Variables.y]: 2774.965527966431
  447. }, {
  448. id: 999,
  449. [Variables.x]: 9368.367656473702,
  450. [Variables.y]: 2638.760240996886
  451. }, {
  452. id: 999,
  453. [Variables.x]: 9108.93843443585,
  454. [Variables.y]: 2637.9999992425182
  455. }, {
  456. id: 999,
  457. [Variables.x]: 8886.996496464813,
  458. [Variables.y]: 2740.465721502559
  459. }, {
  460. id: 999,
  461. [Variables.x]: 8591.98848042534,
  462. [Variables.y]: 2697.955473152916
  463. }, {
  464. id: 999,
  465. [Variables.x]: 8364.02653944699,
  466. [Variables.y]: 2742.099189166931
  467. }, {
  468. id: 999,
  469. [Variables.x]: 8018.224819551448,
  470. [Variables.y]: 2652.8442740990295
  471. }, {
  472. id: 999,
  473. [Variables.x]: 7777.999486631112,
  474. [Variables.y]: 2606.9522705110076
  475. }, {
  476. id: 999,
  477. [Variables.x]: 7558.001173278906,
  478. [Variables.y]: 2890.046991103157
  479. }, {
  480. id: 999,
  481. [Variables.x]: 8127.3105680599665,
  482. [Variables.y]: 2890.999995021336
  483. }, {
  484. id: 999,
  485. [Variables.x]: 7398.508914037662,
  486. [Variables.y]: 2668.8699230283755
  487. }, {
  488. id: 999,
  489. [Variables.x]: 6708.262218454327,
  490. [Variables.y]: 2866.24706119208
  491. }, {
  492. id: 999,
  493. [Variables.x]: 6880.874061431822,
  494. [Variables.y]: 2568.0547673207466
  495. }, {
  496. id: 999,
  497. [Variables.x]: 7048.001181302265,
  498. [Variables.y]: 2683.998365437441
  499. }, {
  500. id: 999,
  501. [Variables.x]: 6384.51880056193,
  502. [Variables.y]: 2633.012344760018
  503. }, {
  504. id: 999,
  505. [Variables.x]: 6229.001527052843,
  506. [Variables.y]: 2724.000037299408
  507. }, {
  508. id: 999,
  509. [Variables.x]: 6185.032206096412,
  510. [Variables.y]: 2552.328289336163
  511. }, {
  512. id: 999,
  513. [Variables.x]: 5833.001081234768,
  514. [Variables.y]: 2515.000004783373
  515. }, {
  516. id: 999,
  517. [Variables.x]: 5635.013000179002,
  518. [Variables.y]: 2715.132991764611
  519. }, {
  520. id: 999,
  521. [Variables.x]: 4983.825719408364,
  522. [Variables.y]: 2630.2715949351987
  523. }, {
  524. id: 999,
  525. [Variables.x]: 4808.991452957154,
  526. [Variables.y]: 2675.0019236474545
  527. }, {
  528. id: 999,
  529. [Variables.x]: 4529.012077026215,
  530. [Variables.y]: 2794.998442785668
  531. }, {
  532. id: 999,
  533. [Variables.x]: 4248.154513207736,
  534. [Variables.y]: 2644.1945023172448
  535. }, {
  536. id: 999,
  537. [Variables.x]: 3829.7973412358106,
  538. [Variables.y]: 2707.1158592753254
  539. }, {
  540. id: 999,
  541. [Variables.x]: 3546.763829523222,
  542. [Variables.y]: 2679.8762554251716
  543. }, {
  544. id: 999,
  545. [Variables.x]: 3265.379713427688,
  546. [Variables.y]: 2884.726069333624
  547. }, {
  548. id: 999,
  549. [Variables.x]: 2752.170958277778,
  550. [Variables.y]: 2757.172314205808
  551. }, {
  552. id: 999,
  553. [Variables.x]: 2342.000023920623,
  554. [Variables.y]: 2541.7259192431193
  555. }, {
  556. id: 999,
  557. [Variables.x]: 2393.0000001045064,
  558. [Variables.y]: 2546.020440082226
  559. }, {
  560. id: 999,
  561. [Variables.x]: 2375.214639614609,
  562. [Variables.y]: 2785.050511999293
  563. }, {
  564. id: 999,
  565. [Variables.x]: 2011.4663935069682,
  566. [Variables.y]: 2678.3053400094395
  567. }, {
  568. id: 999,
  569. [Variables.x]: 2319.999998340479,
  570. [Variables.y]: 2512.063388541019
  571. }, {
  572. id: 999,
  573. [Variables.x]: 1781.5653155460602,
  574. [Variables.y]: 2919.7695949555446
  575. }, {
  576. id: 999,
  577. [Variables.x]: 1457.9829399058456,
  578. [Variables.y]: 2732.69666008065
  579. }, {
  580. id: 999,
  581. [Variables.x]: 1121.8816981507593,
  582. [Variables.y]: 2643.8009150795624
  583. }, {
  584. id: 999,
  585. [Variables.x]: 902.8558665635351,
  586. [Variables.y]: 2914.533541069445
  587. }, {
  588. id: 999,
  589. [Variables.x]: 617.7088262599689,
  590. [Variables.y]: 3000.208332291725
  591. }, {
  592. id: 999,
  593. [Variables.x]: 115.76284446446414,
  594. [Variables.y]: 2761.1691492848804
  595. }, {
  596. id: 999,
  597. [Variables.x]: 443.999174424608,
  598. [Variables.y]: 2626.910633614252
  599. }, {
  600. id: 999,
  601. [Variables.x]: 401.0006173978146,
  602. [Variables.y]: 532.9993392260212
  603. }, {
  604. id: 888,
  605. [Variables.x]: 146.3497840873793,
  606. [Variables.y]: 7519.927999039886
  607. }, {
  608. id: 888,
  609. [Variables.x]: 391.0196308967286,
  610. [Variables.y]: 7549.085720093481
  611. }, {
  612. id: 888,
  613. [Variables.x]: 543.1371807981709,
  614. [Variables.y]: 7533.976836147818
  615. }, {
  616. id: 888,
  617. [Variables.x]: 697.0531620113139,
  618. [Variables.y]: 7550.005525482361
  619. }, {
  620. id: 888,
  621. [Variables.x]: 841.2366989055986,
  622. [Variables.y]: 7546.024636082353
  623. }, {
  624. id: 888,
  625. [Variables.x]: 1002.1840190174183,
  626. [Variables.y]: 7499.675493417864
  627. }, {
  628. id: 888,
  629. [Variables.x]: 1142.6196506884087,
  630. [Variables.y]: 7548.285257450758
  631. }, {
  632. id: 888,
  633. [Variables.x]: 1304.2958114699852,
  634. [Variables.y]: 7548.0000001380395
  635. }, {
  636. id: 888,
  637. [Variables.x]: 1461.2890760037862,
  638. [Variables.y]: 7504.484162973849
  639. }, {
  640. id: 888,
  641. [Variables.x]: 1599.1268933314354,
  642. [Variables.y]: 7552.456685165645
  643. }, {
  644. id: 888,
  645. [Variables.x]: 1759.204500911972,
  646. [Variables.y]: 7529.112818068299
  647. }, {
  648. id: 888,
  649. [Variables.x]: 1885.5663898853736,
  650. [Variables.y]: 7535.997014384194
  651. }, {
  652. id: 888,
  653. [Variables.x]: 2008.864282123885,
  654. [Variables.y]: 7534.011987392109
  655. }, {
  656. id: 888,
  657. [Variables.x]: 2169.451157581377,
  658. [Variables.y]: 7508.428652937195
  659. }, {
  660. id: 888,
  661. [Variables.x]: 2321.4119053460654,
  662. [Variables.y]: 7524.004600254365
  663. }, {
  664. id: 888,
  665. [Variables.x]: 2445.37679324718,
  666. [Variables.y]: 7556.959438438634
  667. }, {
  668. id: 888,
  669. [Variables.x]: 2605.4951406107575,
  670. [Variables.y]: 7557.0000001068265
  671. }, {
  672. id: 888,
  673. [Variables.x]: 2745.837252598174,
  674. [Variables.y]: 7513.389117185103
  675. }, {
  676. id: 888,
  677. [Variables.x]: 2870.119102149074,
  678. [Variables.y]: 7545.351524404612
  679. }, {
  680. id: 888,
  681. [Variables.x]: 3053.1769305206426,
  682. [Variables.y]: 7545.000003910216
  683. }, {
  684. id: 888,
  685. [Variables.x]: 3154.026610855043,
  686. [Variables.y]: 7492.703531529384
  687. }, {
  688. id: 888,
  689. [Variables.x]: 3241.745184056783,
  690. [Variables.y]: 7558.0648618785635
  691. }, {
  692. id: 888,
  693. [Variables.x]: 3452.00226701193,
  694. [Variables.y]: 7544.999961196074
  695. }, {
  696. id: 888,
  697. [Variables.x]: 3567.4144062974487,
  698. [Variables.y]: 7498.745675591474
  699. }, {
  700. id: 888,
  701. [Variables.x]: 3688.934608223305,
  702. [Variables.y]: 7531.10369153833
  703. }, {
  704. id: 888,
  705. [Variables.x]: 3791.186191689511,
  706. [Variables.y]: 7520.999459482911
  707. }, {
  708. id: 888,
  709. [Variables.x]: 3906.079096108739,
  710. [Variables.y]: 7543.998942932907
  711. }, {
  712. id: 888,
  713. [Variables.x]: 4044.2380426104028,
  714. [Variables.y]: 7543.999999992666
  715. }, {
  716. id: 888,
  717. [Variables.x]: 4174.286212080739,
  718. [Variables.y]: 7505.998008278797
  719. }, {
  720. id: 888,
  721. [Variables.x]: 4319.522512008703,
  722. [Variables.y]: 7537.101396727113
  723. }, {
  724. id: 888,
  725. [Variables.x]: 4433.000000004023,
  726. [Variables.y]: 7513.999999995751
  727. }, {
  728. id: 888,
  729. [Variables.x]: 4555.716798990464,
  730. [Variables.y]: 7546.0026680826795
  731. }, {
  732. id: 888,
  733. [Variables.x]: 4670.1247637998,
  734. [Variables.y]: 7523.046104406854
  735. }, {
  736. id: 888,
  737. [Variables.x]: 4794.617556083352,
  738. [Variables.y]: 7555.999791719118
  739. }, {
  740. id: 888,
  741. [Variables.x]: 4941.651040639689,
  742. [Variables.y]: 7524.000003661002
  743. }, {
  744. id: 888,
  745. [Variables.x]: 5042.602176094363,
  746. [Variables.y]: 7556.0006088283935
  747. }, {
  748. id: 888,
  749. [Variables.x]: 5180.459249490879,
  750. [Variables.y]: 7556.00000000101
  751. }, {
  752. id: 888,
  753. [Variables.x]: 5303.000933676377,
  754. [Variables.y]: 7501.028451187172
  755. }, {
  756. id: 888,
  757. [Variables.x]: 5419.518179728937,
  758. [Variables.y]: 7548.018130776565
  759. }, {
  760. id: 888,
  761. [Variables.x]: 5557.021528601353,
  762. [Variables.y]: 7525.360710641226
  763. }, {
  764. id: 888,
  765. [Variables.x]: 5679.548749434651,
  766. [Variables.y]: 7558.387682614479
  767. }, {
  768. id: 888,
  769. [Variables.x]: 5817.081907074551,
  770. [Variables.y]: 7535.225502179956
  771. }, {
  772. id: 888,
  773. [Variables.x]: 5955.801011406585,
  774. [Variables.y]: 7536.998169722631
  775. }, {
  776. id: 888,
  777. [Variables.x]: 6058.068886876112,
  778. [Variables.y]: 7503.843014156425
  779. }, {
  780. id: 888,
  781. [Variables.x]: 6182.08285499084,
  782. [Variables.y]: 7536.468905493149
  783. }, {
  784. id: 888,
  785. [Variables.x]: 6319.000298599492,
  786. [Variables.y]: 7559.223506154572
  787. }, {
  788. id: 888,
  789. [Variables.x]: 6456.0438409023,
  790. [Variables.y]: 7559.000001239853
  791. }, {
  792. id: 888,
  793. [Variables.x]: 6593.708873816226,
  794. [Variables.y]: 7559.000000000004
  795. }, {
  796. id: 888,
  797. [Variables.x]: 6694.621021783071,
  798. [Variables.y]: 7503.922669545933
  799. }, {
  800. id: 888,
  801. [Variables.x]: 6802.017532395823,
  802. [Variables.y]: 7543.013844983488
  803. }, {
  804. id: 888,
  805. [Variables.x]: 6939.576139515191,
  806. [Variables.y]: 7519.736835652795
  807. }, {
  808. id: 888,
  809. [Variables.x]: 7094.688032200829,
  810. [Variables.y]: 7540.085798774424
  811. }, {
  812. id: 888,
  813. [Variables.x]: 7226.998639368321,
  814. [Variables.y]: 7522.058989048326
  815. }, {
  816. id: 888,
  817. [Variables.x]: 7387.01121045099,
  818. [Variables.y]: 7544.002188008208
  819. }, {
  820. id: 888,
  821. [Variables.x]: 7525.164163912381,
  822. [Variables.y]: 7520.477342503655
  823. }, {
  824. id: 888,
  825. [Variables.x]: 7682.63209343086,
  826. [Variables.y]: 7520.950333690332
  827. }, {
  828. id: 888,
  829. [Variables.x]: 7819.874119219743,
  830. [Variables.y]: 7474.529781602834
  831. }, {
  832. id: 888,
  833. [Variables.x]: 7914.101850271172,
  834. [Variables.y]: 7546.273684819922
  835. }, {
  836. id: 888,
  837. [Variables.x]: 8075.163398710387,
  838. [Variables.y]: 7523.178479254832
  839. }, {
  840. id: 888,
  841. [Variables.x]: 8243.626299995074,
  842. [Variables.y]: 7529.999928226666
  843. }, {
  844. id: 888,
  845. [Variables.x]: 8381.398267091548,
  846. [Variables.y]: 7506.778270687802
  847. }, {
  848. id: 888,
  849. [Variables.x]: 8610.0060525894,
  850. [Variables.y]: 7529.696290884706
  851. }, {
  852. id: 888,
  853. [Variables.x]: 8770.417583524257,
  854. [Variables.y]: 7553.000247702051
  855. }, {
  856. id: 888,
  857. [Variables.x]: 8448.995853929235,
  858. [Variables.y]: 7553.000000000004
  859. }, {
  860. id: 888,
  861. [Variables.x]: 8929.703318071148,
  862. [Variables.y]: 7552.999999999999
  863. }, {
  864. id: 888,
  865. [Variables.x]: 9044.893738170069,
  866. [Variables.y]: 7504.45378526034
  867. }, {
  868. id: 888,
  869. [Variables.x]: 9233.46060143763,
  870. [Variables.y]: 7495.997477063163
  871. }, {
  872. id: 888,
  873. [Variables.x]: 9348.000125187058,
  874. [Variables.y]: 7541.000685853901
  875. }, {
  876. id: 888,
  877. [Variables.x]: 9572.018260313409,
  878. [Variables.y]: 7527.314604546699
  879. }, {
  880. id: 888,
  881. [Variables.x]: 9702.810491263053,
  882. [Variables.y]: 7511.700779821693
  883. }, ...generatePositions(100, 777), ...generatePositions(100, 666), ...generatePositions(100, 555) ];
  884. log(Variables);
  885. window.Variables = Variables;
  886. Hook.prepend("injected?", /^\(function/, `log("Injected!");`);
  887. Hook.append("biomes", /\w\(9282\),(\w{2})=\w\.\w\(\w{2}\).+?;/, `${local}.biomes=$2();${local}.changeIndex($2());`);
  888. Hook.append("camera object", /0,40\);/, `${local}.cam=${cam};`);
  889. Hook.append("define renderer", /function (\w{2})\(\w,\w,\w,\w\){const \w=\w\[.+?}/, `;${local}.renderObj=$2;`);
  890. Hook.append("my x,y", /const (\w)=\w\.get\(\w{2}\);/, `${local}.defineData($2);`);
  891. Hook.append("frame update", /Date,(\w)=\(\w-\w{2}\)\/1e3;/, `${local}.updateFrame($2);`);
  892. Hook.append("hook canvas", /\.\w{2}&&\w{2}\(\w\[\w\],\w\[\w\]\.\w{2},\w\(\)\.\w{2},\w\)/, `;${local}.hookCanvas(${ctx});`);
  893. Hook.append("renderer", /=1}function \w{2}\((\w),\w\){.+?\),.+?,/, `${local}.renderDecorations($2),`);
  894. return Hook.code;
  895. };
  896. window.eval = new Proxy(window.eval, {
  897. apply(target, _this, args) {
  898. const code = args[0];
  899. if (code.length > 1e5) {
  900. args[0] = applyHooks(code);
  901. window.eval = target;
  902. document.title = "Sploop";
  903. target.apply(_this, args);
  904. return;
  905. }
  906. return target.apply(_this, args);
  907. }
  908. });
  909. const main_log = console.log;
  910. window.log = main_log;
  911. let delta;
  912. const isIntersect = (Ax, Ay, Aw, Ah, Bx, By, Bw, Bh) => Bx + Bw > Ax && By + Bh > Ay && Ax + Aw > Bx && Ay + Ah > By;
  913. const coolDownOver = (currentTimeStamp, previousTimeStamp, interval) => currentTimeStamp - previousTimeStamp > interval;
  914. const defineData = myPlayer => {
  915. if (myPlayer) {
  916. storage.myX = myPlayer[Variables.x];
  917. storage.myY = myPlayer[Variables.y];
  918. }
  919. };
  920. const renderDecorations = ctx => {
  921. decorations.forEach((decoration => {
  922. if (Math.hypot(storage.myX - Number(decoration[Variables.x]), storage.myY - Number(decoration[Variables.y])) < 1500) storage.renderObj(decoration, decoration.id, ctx);
  923. }));
  924. };
  925. const biomes = {
  926. snow: {
  927. x: 160,
  928. y: 160,
  929. w: 9840,
  930. h: 2230
  931. },
  932. desert: {
  933. x: 160,
  934. y: 9190,
  935. w: 9840,
  936. h: 840
  937. },
  938. river: {
  939. x: 160,
  940. y: 8e3,
  941. w: 9840,
  942. h: 1e3
  943. }
  944. };
  945. let strength = .07;
  946. let riverAccumulator = 0;
  947. const hookCanvas = ctx => {
  948. if (!ctx || !storage.cam) return;
  949. const canvas = document.querySelector("#game-canvas");
  950. const scaleFactor = 1;
  951. const vx = storage.cam[Variables.camX] - canvas.width / scaleFactor / 2;
  952. const vy = storage.cam[Variables.camY] - canvas.height / scaleFactor / 2;
  953. const vw = canvas.width / scaleFactor;
  954. const vh = canvas.height / scaleFactor;
  955. const s_x = biomes.snow.x;
  956. const s_y = biomes.snow.y;
  957. const s_w = biomes.snow.w;
  958. const s_h = biomes.snow.h;
  959. const d_x = biomes.desert.x;
  960. const d_y = biomes.desert.y;
  961. const d_w = biomes.desert.w;
  962. const d_h = biomes.desert.h;
  963. const r_x = biomes.river.x;
  964. const r_y = biomes.river.y;
  965. const r_w = biomes.river.w;
  966. const r_h = biomes.river.h;
  967. const canSeeDesert = isIntersect(d_x, d_y, d_w, d_h, vx, vy, vw, vh);
  968. const canSeeSnow = isIntersect(s_x, s_y, s_w, s_h, vx, vy, vw, vh);
  969. const canSeeRiver = isIntersect(r_x, r_y, r_w, r_h, vx, vy, vw, vh);
  970. if (canSeeRiver) {
  971. riverAccumulator = (riverAccumulator + delta) % (2 * Math.PI);
  972. const offset = strength * Math.sin(riverAccumulator);
  973. storage.biomes[4][Variables.biomeY] -= offset;
  974. storage.biomes[4][Variables.biomeHeight] += offset;
  975. }
  976. if (canSeeSnow) {
  977. particles.updateType(0);
  978. } else if (canSeeDesert) {
  979. particles.updateType(1);
  980. }
  981. if (canSeeSnow || canSeeDesert) particles.render(ctx, delta, vx, vy, vw, vh);
  982. };
  983. const updateFrame = ms => {
  984. delta = ms;
  985. };
  986. let assets = {};
  987. assets.canvasCache = {};
  988. assets.createCanvasCacheKey = function(key, width, height) {
  989. return `${key}-${width}x${height}`;
  990. };
  991. assets.getCanvas = function(key, width, height) {
  992. return this.canvasCache[this.createCanvasCacheKey(key, width, height)];
  993. };
  994. assets.deleteCanvas = function(key, width, height) {
  995. delete assets.canvasCache[this.createCanvasCacheKey(key, width, height)];
  996. };
  997. assets.imgCache = {};
  998. assets.drawImageToCanvas = function(img, canvas, tint) {
  999. let ctx = canvas.getContext("2d");
  1000. ctx.clearRect(0, 0, canvas.width, canvas.height);
  1001. ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
  1002. if (tint) {
  1003. ctx.save();
  1004. ctx.globalCompositeOperation = "source-atop";
  1005. ctx.fillStyle = tint;
  1006. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1007. ctx.restore();
  1008. }
  1009. };
  1010. assets.createCanvas = function(key, width, height) {
  1011. width = Math.ceil(width);
  1012. height = Math.ceil(height);
  1013. let canvas = document.createElement("canvas");
  1014. canvas.width = width;
  1015. canvas.height = height;
  1016. assets.canvasCache[this.createCanvasCacheKey(key, width, height)] = canvas;
  1017. return canvas;
  1018. };
  1019. assets.getImage = function(path, width = 256, height = 256, tint = null) {
  1020. width = Math.ceil(width);
  1021. height = Math.ceil(height);
  1022. let canvasKey = tint ? `${path}:${tint}` : path;
  1023. let canvas = this.getCanvas(canvasKey, width, height);
  1024. if (!canvas) {
  1025. canvas = this.createCanvas(canvasKey, width, height);
  1026. let img = assets.imgCache[path];
  1027. if (img) {
  1028. if (img.isLoaded) {
  1029. this.drawImageToCanvas(img, canvas, tint);
  1030. } else {
  1031. img.addEventListener("load", (() => this.drawImageToCanvas(img, canvas, tint)));
  1032. }
  1033. } else {
  1034. let img = new Image;
  1035. img.isLoaded = false;
  1036. img.src = path;
  1037. img.addEventListener("load", (() => {
  1038. this.drawImageToCanvas(img, canvas, tint);
  1039. img.isLoaded = true;
  1040. }));
  1041. img.addEventListener("error", (() => {
  1042. console.error("Error loading image:", path);
  1043. delete assets.imgCache[path];
  1044. this.deleteCanvas(path, width, height);
  1045. }));
  1046. this.imgCache[path] = img;
  1047. }
  1048. }
  1049. return canvas;
  1050. };
  1051. let utils = {};
  1052. utils.drawImage = (ctx, img, x, y, scale = 1) => {
  1053. ctx.drawImage(img, x - img.width / 2, y - img.height / 2);
  1054. };
  1055. class ParticleManager {
  1056. constructor(game) {
  1057. this.game = game;
  1058. this.particles = [];
  1059. this.toDispose = [];
  1060. this.config = {
  1061. 0: {
  1062. maxLife: 2e3,
  1063. speed: 20
  1064. }
  1065. };
  1066. }
  1067. generateParticles(quanity = 10, type = 0) {
  1068. for (let i = 0; i < quanity; i++) {
  1069. this.particles.push([ 100 + Math.random() * 100, 40 * Math.random(), type, performance.now() - 2e3 * Math.random(), Math.PI * Math.random() ]);
  1070. }
  1071. }
  1072. updateType(type) {
  1073. for (let i = 0; i < this.particles.length; i++) {
  1074. this.particles[i][2] = type;
  1075. }
  1076. }
  1077. flush() {
  1078. this.particles = [];
  1079. }
  1080. resetParticle(particle, timeStamp, vx, vy, vw, vh) {
  1081. particle[3] = timeStamp - Math.random() * 2e3;
  1082. particle[1] = vy + Math.random() * vh;
  1083. particle[0] = vx + Math.random() * vw;
  1084. }
  1085. render(ctx, delta, vx, vy, vw, vh) {
  1086. const now = performance.now();
  1087. for (let i = 0; i < this.particles.length; i++) {
  1088. const particle = this.particles[i];
  1089. particle[4] = (particle[4] + delta) % (2 * Math.PI);
  1090. if (coolDownOver(now, particle[3], this.config[0].maxLife)) this.resetParticle(particle, now, vx, vy, vw, vh);
  1091. particle[1] += 100 * delta * Math.sin(particle[4] > Math.PI ? particle[4] + Math.PI : particle[4]);
  1092. particle[0] += 100 * delta * Math.cos(particle[4]);
  1093. const alpha = Math.abs(Math.sin(Math.PI * (now - particle[3]) / this.config[0].maxLife));
  1094. ctx.globalAlpha = alpha;
  1095. switch (particle[2]) {
  1096. case 0:
  1097. utils.drawImage(ctx, assets.getImage("https://cdn.glitch.global/f130fdcd-6684-4ec2-86bd-350f8a62abb7/snow.png?v=1734601216160", 32, 32), particle[0], particle[1]);
  1098. break;
  1099.  
  1100. case 1:
  1101. utils.drawImage(ctx, assets.getImage("https://cdn.glitch.global/f130fdcd-6684-4ec2-86bd-350f8a62abb7/sand.png?v=1734601248796", 32, 32), particle[0], particle[1]);
  1102. break;
  1103. }
  1104. ctx.globalAlpha = 1;
  1105. }
  1106. }
  1107. }
  1108. const changeIndex = biomes => {
  1109. [biomes[biomes.length - 1], biomes[biomes.length - 2]] = [ biomes[biomes.length - 2], biomes[biomes.length - 1] ];
  1110. biomes[4][Variables.biomeY] = 7995;
  1111. biomes[4][Variables.biomeHeight] = 9005;
  1112. };
  1113. const particles = new ParticleManager;
  1114. particles.generateParticles(4, 1);
  1115. window.particleManager = particles;
  1116. const storage = {
  1117. myX: 0,
  1118. myY: 0,
  1119. renderObj: undefined,
  1120. cam: undefined,
  1121. biomes: undefined,
  1122. updateFrame,
  1123. hookCanvas,
  1124. defineData,
  1125. changeIndex,
  1126. renderDecorations
  1127. };
  1128. window.storage = storage;
  1129. })();

QingJ © 2025

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