Greasy Fork is available in English.

Gartic.io Anonim Menu

Press F2 to open and close the menu

La data de 12-01-2024. Vezi ultima versiune.

  1. // ==UserScript==
  2. // @name Gartic.io Anonim Menu
  3. // @namespace https://greasyfork.org/
  4. // @version 2024-01-11
  5. // @description Press F2 to open and close the menu
  6. // @author anonimbiri
  7. // @match https://gartic.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=gartic.io
  9. // @require https://update.greasyfork.org/scripts/482771/1303809/Malayala%20Kit.js
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. const AnonimbiriAPI = {
  14. ws: null,
  15. isGame: false,
  16. playerId: null,
  17. unlimitedKick: false,
  18. autoSkip: false,
  19. antiAfk: false,
  20. noCooldown: false,
  21. autoGuessing: false,
  22. hint: null,
  23. wordListURL: null,
  24. wordList: [],
  25. debug: false,
  26. };
  27.  
  28. const kit = new MalayalaKit.CreateMenu({
  29. title: "Anonim Menu",
  30. icon: "",
  31. size: { width: 500, height: 400 },
  32. position: { top: 50, left: 50 },
  33. hotkey: { keyCode: 113, ctrlKey: false, altKey: false, shiftKey: false },
  34. });
  35.  
  36. const general = new MalayalaKit.Tab("General");
  37. general.addSwitch({
  38. label: "Unlimited Kick",
  39. value: false,
  40. onchange: (value) => {
  41. AnonimbiriAPI.unlimitedKick = value;
  42. },
  43. });
  44. general.addSwitch({
  45. label: "Auto Skip",
  46. value: false,
  47. onchange: (value) => {
  48. AnonimbiriAPI.autoSkip = value;
  49. },
  50. });
  51. general.addSwitch({
  52. label: "Anti Afk",
  53. value: false,
  54. onchange: (value) => {
  55. AnonimbiriAPI.antiAfk = value;
  56. },
  57. });
  58. general.addSwitch({
  59. label: "No Cooldown For Room Change",
  60. value: false,
  61. onchange: (value) => {
  62. AnonimbiriAPI.noCooldown = value;
  63. },
  64. });
  65. kit.addTab(general);
  66.  
  67. const guess = new MalayalaKit.Tab("Guess");
  68. guess.addSwitch({
  69. label: "Auto Guessing",
  70. value: false,
  71. onchange: (value) => {
  72. AnonimbiriAPI.autoGuessing = value;
  73. },
  74. });
  75. guess.addInput({
  76. label: "Word List",
  77. placeholder: "wordList.txt",
  78. type: "text",
  79. value: AnonimbiriAPI.wordListURL,
  80. onchange: (value) => {
  81. AnonimbiriAPI.wordListURL = value;
  82. fetch(AnonimbiriAPI.wordListURL)
  83. .then(response => response.text())
  84. .then(data => {
  85. AnonimbiriAPI.wordList = data.split('\n').map(word => word.trim().toLowerCase());
  86. }).catch(error => AnonimbiriAPI.debug && console.error('Error:', error));
  87. },
  88. });
  89. kit.addTab(guess);
  90.  
  91. const fakeWinText = "anonimbiri";
  92. const local = new MalayalaKit.Tab("Local");
  93. local.addInput({
  94. label: "Fake Win text",
  95. placeholder: "Enter Fake Win text",
  96. type: "text",
  97. value: fakeWinText,
  98. onchange: (value) => {
  99. fakeWinText = value;
  100. },
  101. });
  102. local.addButton({
  103. label: "Send Fake Win",
  104. buttonLabel: "Send Fake Win",
  105. onclick: () => {
  106. const event = new MessageEvent("message", {
  107. data: `42["26","${fakeWinText}",10,11,10000]`,
  108. });
  109. AnonimbiriAPI.ws.dispatchEvent(event);
  110. },
  111. });
  112. kit.addTab(local);
  113.  
  114. let intervalId = null;
  115. let spamText = "anonimbiri";
  116. const spam = new MalayalaKit.Tab("Spam");
  117. spam.addSwitch({
  118. label: "Spam",
  119. value: false,
  120. onchange: (value) => {
  121. if (value) {
  122. intervalId = setInterval(() => {
  123. const randomIndex = Math.floor(Math.random() * (spamText.length + 1));
  124. const newText = spamText.replace(/(‎{${randomIndex}})/, '$1.');
  125. AnonimbiriAPI.ws.send(`42[11,${AnonimbiriAPI.playerId},"${newText}"]`);
  126. }, 800);
  127. } else {
  128. clearInterval(intervalId);
  129. }
  130. },
  131. });
  132. spam.addInput({
  133. label: "Spam text",
  134. placeholder: "Enter Spam text",
  135. type: "text",
  136. value: spamText,
  137. onchange: (value) => {
  138. spamText = value;
  139. },
  140. });
  141. kit.addTab(spam);
  142.  
  143. let intervalHint = null;
  144. let index = 0;
  145. window.WebSocket = class extends WebSocket {
  146. constructor(...args) {
  147. super(...args);
  148. AnonimbiriAPI.ws = this;
  149. this.addEventListener("message", (e) => {
  150. AnonimbiriAPI.debug && console.log("%c<--- Received data:", "color: pink", e.data);
  151. const messageData = JSON.parse(e.data.slice(2));
  152. if (messageData[0] === "45" && AnonimbiriAPI.unlimitedKick) {
  153. const OriginalDate = window.Date;
  154. window.Date = class extends Date {
  155. static now() {
  156. return super.now() * 2123;
  157. }
  158. };
  159. setTimeout(() => {
  160. window.Date = OriginalDate;
  161. }, 2000);
  162. return;
  163. } else if (messageData[0] === "5") {
  164. AnonimbiriAPI.isGame = true;
  165. AnonimbiriAPI.playerId = messageData[2];
  166. } else if (messageData[0] === "16" && AnonimbiriAPI.autoSkip) {
  167. AnonimbiriAPI.ws.send(`42[25,${AnonimbiriAPI.playerId}]`);
  168. } else if (messageData[0] === "34") {
  169. AnonimbiriAPI.ws.send(`42[30,${AnonimbiriAPI.playerId}]`);
  170. AnonimbiriAPI.ws.send(`42[30,${AnonimbiriAPI.playerId}]`);
  171. AnonimbiriAPI.ws.send(`42[30,${AnonimbiriAPI.playerId}]`);
  172. } else if (messageData[0] === "19" && AnonimbiriAPI.antiAfk) {
  173. window.Date = class extends Date {
  174. static now() {
  175. return super.now() / 2123;
  176. }
  177. };
  178. } else if (messageData[0] === "23") {
  179. !AnonimbiriAPI.debug && console.clear();
  180. const nickElements = document.querySelectorAll('.nick');
  181. nickElements.forEach((nickElement) => {
  182. const nickName = nickElement.innerText;
  183. if (
  184. nickName.startsWith('‎') &&
  185. !nickElement.parentElement.querySelector('.cheater') &&
  186. !nickElement.parentElement.parentElement.classList.contains('you')
  187. ) {
  188. const newElement = document.createElement('span');
  189. newElement.classList.add('cheater');
  190. newElement.style = 'color:pink; font-weight: bold; font-family: "Lucida Console", "Courier New", monospace;';
  191. newElement.innerText = `🎮 Cheater`;
  192. nickElement.parentElement.appendChild(newElement);
  193. }
  194. });
  195. } else if (messageData[0] ==="30") {
  196. AnonimbiriAPI.hint = messageData[1].join('');
  197. if(!AnonimbiriAPI.autoGuessing && !AnonimbiriAPI.hint && intervalHint) return;
  198. setInterval(() => {
  199. const hints = guessWord(AnonimbiriAPI.hint);
  200. if (index < hints.length) AnonimbiriAPI.ws.send(`42[13,${AnonimbiriAPI.playerId},"${hints[index++]}"]`), AnonimbiriAPI.wordList.splice(AnonimbiriAPI.wordList.indexOf(hints[index++]), 1);
  201. else clearInterval(intervalHint);
  202. }, 1000);
  203.  
  204. } else if (messageData[0] ==="19" && intervalHint) {
  205. AnonimbiriAPI.hint = null;
  206. clearInterval(intervalHint);
  207. fetch(AnonimbiriAPI.wordListURL)
  208. .then(response => response.text())
  209. .then(data => {
  210. AnonimbiriAPI.wordList = data.split('\n').map(word => word.trim().toLowerCase());
  211. }).catch(error => AnonimbiriAPI.debug && console.error('Error:', error));
  212. } else if (messageData[0] ==="13" && AnonimbiriAPI.wordList.length !== 0) {
  213. const index = AnonimbiriAPI.wordList.indexOf(messageData[1].toLowerCase());
  214. index !== -1 && AnonimbiriAPI.wordList.splice(index, 1)
  215. }
  216. });
  217. }
  218.  
  219. send(data) {
  220. AnonimbiriAPI.debug && console.log("%c---> Sent data:", "color: pink", data);
  221. const newData = JSON.parse(data.slice(2));
  222. if (newData[1] && newData[1].nick) {
  223. newData[1].nick = `‎${newData[1].nick}`;
  224. data = data.slice(0, 2) + JSON.stringify(newData);
  225. super.send(data);
  226. } else if (newData[0] === "46") {
  227. } else {
  228. super.send(data);
  229. }
  230. }
  231. };
  232.  
  233. function guessWord(guessedPattern) {
  234. if (!guessedPattern) return;
  235. const wordList = AnonimbiriAPI.wordList.map(word => word.toLowerCase());
  236. const length = guessedPattern.length;
  237. const possibleWords = [];
  238.  
  239. for (let i = 0; i < wordList.length; i++) {
  240. const word = wordList[i];
  241. if (word.length === length) {
  242. let match = true;
  243.  
  244. for (let j = 0; j < length; j++) {
  245. if (guessedPattern[j] !== '_' && guessedPattern[j] !== word[j]) {
  246. match = false;
  247. break;
  248. }
  249. }
  250.  
  251. if (match) {
  252. possibleWords.push(word);
  253. }
  254. }
  255. }
  256.  
  257. return possibleWords;
  258. }
  259.  
  260. // I'll just leave it here that such a method exists and works
  261. /*function requestText (url) {
  262. return fetch(url).then((d) => {return d.text()})
  263. }
  264. function requestBuffer (url) {
  265. return fetch(url).then((d) => {return d.arrayBuffer()})
  266. }
  267. Node.prototype.appendChild = new Proxy(Node.prototype.appendChild, {
  268. apply: async function (target, thisArg, [element]) {
  269. if (element.tagName === "SCRIPT" && element.src.includes('room')) {
  270. let text = await requestText(element.src);
  271. text = text.replace(/this\._lang\.violatingRules/g, '"dememe"'); // this is the wrong code lol
  272. let blob = new Blob([text]);
  273. element.src = URL.createObjectURL(blob);
  274. }
  275. return Reflect.apply(target, thisArg, [element]);
  276. }
  277. });*/
  278.  
  279. const observer = new MutationObserver(() => {
  280. document.querySelector('input[name="chat"]')?.replaceWith(
  281. Object.assign(document.createElement('input'), {
  282. type: 'text',
  283. name: 'chat',
  284. className: 'mousetrap',
  285. placeholder: '🔓 Chat Unlocked',
  286. autocomplete: 'off',
  287. autocorrect: 'off',
  288. autocapitalize: 'off',
  289. maxLength: 100,
  290. value: '',
  291. })
  292. );
  293. if (document.querySelector('#popUp') && AnonimbiriAPI.noCooldown) {
  294. const OriginalDate = window.Date;
  295. window.Date = class extends Date {
  296. static now() {
  297. return super.now() * 2123;
  298. }
  299. };
  300. setTimeout(() => {
  301. window.Date = class extends Date {
  302. static now() {
  303. return super.now() / 2123;
  304. }
  305. };
  306. }, 500);
  307. document.querySelector('.ic-playHome').click();
  308. }
  309. });
  310.  
  311. observer.observe(document.body, { childList: true, subtree: false });
  312.  
  313. const keyupEvent = (e) => {
  314. if (e.keyCode === 13) {
  315. const chatInput = document.querySelector('input[name="chat"]');
  316. AnonimbiriAPI.ws.send(`42[11,${AnonimbiriAPI.playerId},"${chatInput.value}"]`);
  317. chatInput.value = '';
  318. }
  319. };
  320.  
  321. window.addEventListener('keyup', keyupEvent);
  322. window.AnonimbiriAPI = AnonimbiriAPI;
  323. kit.render();