Bonk Commands

Adds lots of commands to bonk.io. Type /? or /help in bonk chat to get started.

当前为 2022-10-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk Commands
  3. // @namespace https://gf.qytechs.cn/en/scripts/451341-bonk-commands
  4. // @version 3.9
  5. // @description Adds lots of commands to bonk.io. Type /? or /help in bonk chat to get started.
  6. // @author LEGENDBOSS123 + left paren + mastery3
  7. // @match https://bonk.io/*
  8. // @run-at document-idle
  9. // @grant none
  10. // @unwrap
  11. // ==/UserScript==
  12.  
  13. function BonkCommandsScriptInjector(f){
  14. if(document.readyState == "complete"){f();}
  15. else{document.addEventListener('readystatechange',function(){setTimeout(f,1500);});}
  16. }
  17.  
  18. BonkCommandsScriptInjector(function(){
  19. var scope = window;
  20.  
  21. scope.Gwindow = document.getElementById("maingameframe").contentWindow;
  22. scope.Gdocument = document.getElementById("maingameframe").contentDocument;
  23.  
  24. scope.link2pastebin = "https://pastebin.com/2b8XqqYu";
  25. scope.link2greasyfork = "https://gf.qytechs.cn/en/scripts/451341-bonk-commands";
  26.  
  27. if(typeof(scope.injectedBonkCommandsScript)=='undefined'){
  28. scope.injectedBonkCommandsScript = true;
  29. }
  30. else{
  31. for (var i = 0; i < 100000; i++){
  32. clearInterval(i);
  33. }
  34. }
  35. scope.GENERATE_PRIME_NUMBER = function(mini = 0,maxi = 0,choices = []){
  36. if(choices.length == 0){
  37. for(var i = mini;i<maxi+1;i++){
  38. choices.push(i);
  39. }
  40. }
  41. firstTry = choices[Math.floor(Math.random()*choices.length)];
  42. for(var i = 2; i<Math.floor(Math.sqrt(firstTry)+1);i++){
  43. if(i!=firstTry){
  44. if(firstTry%i == 0){
  45. choices.splice(choices.indexOf(firstTry),1);
  46. if(choices.length == 0){
  47. return 0;
  48. }
  49. return GENERATE_PRIME_NUMBER(mini,maxi,choices);
  50. }
  51. }
  52. }
  53. return firstTry;
  54. };
  55.  
  56. scope.GENERATE_KEYS = function(){
  57. interval = [];
  58. for(var i = 100;i<301;i++){
  59. interval.push(i);
  60. }
  61. random_prime = [GENERATE_PRIME_NUMBER(0,0,choices = interval),0];
  62. interval.splice(interval.indexOf(random_prime[0]),1);
  63. random_prime[1] = GENERATE_PRIME_NUMBER(0,0,choices = interval);
  64.  
  65. n = random_prime[0]*random_prime[1];
  66. n2 = (random_prime[0]-1)*(random_prime[1]-1);
  67.  
  68. e = GENERATE_PRIME_NUMBER(2,n2-1);
  69. d = 0;
  70. redo = true;
  71. for(var i = 0;i<1000000;i++){
  72. if((e*i-1)%n2 == 0 && i!=e){
  73. d = i;
  74. redo = false;
  75. break;
  76. }
  77. }
  78. if(redo){
  79. return GENERATE_KEYS();
  80. }
  81. else{
  82. return [[n,e],[n,d]];
  83. }
  84.  
  85. };
  86. scope.CRYPT_NUMBER = function(key, data){
  87.  
  88. result = 1;
  89.  
  90. for(var i = 0;i<key[1];i++){
  91. result*=data;
  92. result = result%key[0];
  93. }
  94. return result%key[0];
  95.  
  96. };
  97.  
  98. scope.CRYPT_MESSAGE = function(key,data){
  99. var resulttext = [];
  100. for(var i = 0;i<data.length;i++){
  101. resulttext.push(CRYPT_NUMBER(key,data[i]));
  102. }
  103. return resulttext;
  104.  
  105. };
  106.  
  107. if(typeof(scope.originalSend)=='undefined'){scope.originalSend = Gwindow.WebSocket.prototype.send;}
  108. if(typeof(scope.bonkwss)=='undefined'){scope.bonkwss = 0;}
  109. if(typeof(scope.sandboxon)=='undefined'){scope.sandboxon = false;}
  110. if(typeof(scope.sandboxid)=='undefined'){scope.sandboxid = 1;}
  111. if(typeof(scope.playerids)=='undefined'){scope.playerids = {};}
  112. if(typeof(scope.sandboxplayerids)=='undefined'){scope.sandboxplayerids = {};}
  113. if(typeof(scope.originalLobbyChat)=='undefined'){scope.originalLobbyChat = Gdocument.getElementById("newbonklobby_chat_content").appendChild;}
  114. if(typeof(scope.originalIngameChat)=='undefined'){scope.originalIngameChat = Gdocument.getElementById("ingamechatcontent").appendChild;}
  115. if(typeof(scope.private_chat_keys)=='undefined'){scope.private_chat_keys = GENERATE_KEYS();scope.private_key = private_chat_keys[0];scope.public_key = private_chat_keys[1];}
  116. function sandboxonclick(){
  117. Gdocument.getElementById("roomlistcreatewindowmaxplayers").value = 1;
  118. Gdocument.getElementById("roomlistcreatewindowunlistedcheckbox").checked = true;
  119. Gdocument.getElementById("roomlistcreatecreatebutton").click();
  120. sandboxon = true;
  121. }
  122. if(Gdocument.getElementById("classic_mid_sandbox")==null){
  123. Gdocument.getElementById("roomlistrefreshbutton").click();
  124. scope.sandboxbutton = Gdocument.createElement("div");
  125. sandboxbutton.id = "classic_mid_sandbox";
  126. sandboxbutton.classList.value = "brownButton brownButton_classic classic_mid_buttons";
  127. sandboxbutton.textContent = "SANDBOX";
  128. sandboxbutton.addEventListener("click",sandboxonclick);
  129. Gdocument.getElementById("classic_mid").insertBefore(sandboxbutton,Gdocument.getElementById("classic_mid_news"));
  130.  
  131. }
  132. Gdocument.getElementById("newbonklobby_chat_content").appendChild = function(args){
  133. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  134. if(args.children[0].textContent.endsWith(" has left the game ") && args.children[0].textContent.startsWith("* ")){
  135. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been kicked from the game ";
  136. }
  137. }
  138. originalLobbyChat.call(this,args);
  139. };
  140. Gdocument.getElementById("ingamechatcontent").appendChild = function(args){
  141. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  142. if(args.children[0].textContent.endsWith(" has left the game.") && args.children[0].textContent.startsWith("* ")){
  143. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been kicked from the game.";
  144. }
  145. }
  146. originalIngameChat.call(this,args);
  147. };
  148. Gwindow.WebSocket.prototype.send = function(args) {
  149. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=")){
  150. bonkwss = this;
  151. if(args.startsWith('42[26,')){
  152. if(sandboxon){
  153. var jsonargs = JSON.parse(args.substring(2))[1];
  154. if(typeof(sandboxplayerids[jsonargs["targetID"]])!='undefined'){
  155. RECIEVE('42[18,'+jsonargs["targetID"]+','+jsonargs["targetTeam"]+']');
  156.  
  157. }
  158. }
  159. }
  160. if(args.startsWith('42[4,')){
  161. var jsonargs = JSON.parse(args.substring(2));
  162. if(sandboxcopyme && typeof(jsonargs[1]["type"])=="undefined"){
  163. var jsonkeys = Object.keys(sandboxplayerids);
  164. for(var i = 0; i<jsonkeys.length;i++){
  165. RECIEVE('42[7,'+jsonkeys[i].toString()+','+JSON.stringify(jsonargs[1])+']');
  166. }
  167. }
  168. args = "42"+JSON.stringify(jsonargs);
  169. }
  170.  
  171. if(args.startsWith('42[5,')){
  172. var jsonargs = JSON.parse(args.substring(2));
  173.  
  174. if(stopquickplay!=1){
  175. jsonargs[1]["gs"]["wl"] = 999;
  176. }
  177. if(recmodebool){
  178. Gdocument.getElementById("newbonklobby_editorbutton").click();
  179. var newmode = Gdocument.getElementById("mapeditor_modeselect").value;
  180. Gdocument.getElementById("mapeditor_close").click();
  181.  
  182. if(newmode!=""){
  183. RECIEVE('42[26,"b","'+newmode+'"]');
  184. }
  185. else{
  186. if(defaultmode != ""){
  187. RECIEVE('42[26,"b","'+defaultmode+'"]');
  188. }
  189. }
  190. }
  191. args = "42"+JSON.stringify(jsonargs);
  192. }
  193.  
  194. }
  195. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=") && !this.injected){
  196. this.injected = true;
  197.  
  198. var originalRecieve = this.onmessage;
  199. this.onmessage = function(args){
  200. if(args.data.startsWith('42[24,')){
  201. beenKickedTimeStamp = Date.now();
  202. }
  203. if(args.data.startsWith('42[1,')){
  204. var jsonargs = JSON.parse(args.data.substring(2));
  205. SEND('42[1,{"id":'+jsonargs[2]+'}]');
  206. }
  207. if(args.data.startsWith('42[7,')){
  208. var jsonargs = JSON.parse(args.data.substring(2))[2];
  209. if(typeof(jsonargs["type"]) != "undefined"){
  210. if(jsonargs["type"]=="private chat" && jsonargs["to"] == username && !ignorepmlist.includes(jsonargs["from"])){
  211. if(typeof(jsonargs["message"])=="object" && typeof(jsonargs["password"]) == "object"){
  212. var password = CRYPT_MESSAGE(private_key,jsonargs["password"]);
  213. var decodedtext = jsonargs["message"].slice(0,400);
  214. var encodedtext = "";
  215. for(var i=0;i<decodedtext.length;i++){
  216. if(password[i%password.length]<1000){
  217. encodedtext+=String.fromCharCode(password[i%password.length]^decodedtext[i]);
  218. }
  219. }
  220. displayInChat("> "+jsonargs["from"]+": "+encodedtext,"#DA0808","#1EBCC1");
  221. }
  222. }
  223. if(jsonargs["type"]=="request public key" && jsonargs["to"] == username){
  224. SEND("42"+JSON.stringify([4,{"type":"public key","from":username,"public key":public_key}]));
  225. }
  226. if(jsonargs["type"]=="public key" && jsonargs["from"] == private_chat && request_public_key_time_stamp+1500>Date.now()){
  227. private_chat_public_key = [private_chat,jsonargs["public key"]];
  228. displayInChat("Private chatting with "+private_chat+".","#DA0808","#1EBCC1");
  229.  
  230. }
  231.  
  232. }
  233. }
  234.  
  235. if(args.data.startsWith('42[4,')){
  236. var jsonargs = JSON.parse(args.data.substring(2));
  237. playerids[jsonargs[1]] = jsonargs[3];
  238.  
  239. }
  240. if(args.data.startsWith('42[5,')){
  241. var jsonargs = JSON.parse(args.data.substring(2));
  242. if(typeof(playerids[jsonargs[1]])!='undefined'){
  243. delete playerids[jsonargs[1]];
  244. }
  245. }
  246. return originalRecieve.call(this,args);
  247. };
  248.  
  249. var originalClose = this.onclose;
  250. this.onclose = function () {
  251. window.bonkwss = 0;
  252. return originalClose.call(this);
  253. }
  254.  
  255. }
  256.  
  257. return originalSend.call(this,args);
  258. };
  259.  
  260. scope.SEND = function(args){
  261. if(bonkwss!=0){
  262. bonkwss.send(args);
  263. }
  264. };
  265. scope.RECIEVE = function(args){
  266. if(bonkwss!=0){
  267. bonkwss.onmessage({data:args});
  268. }
  269. };
  270. Gdocument.getElementById("ingamechatcontent").style["pointer-events"]="all";
  271. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  272. Gdocument.getElementById("ingamechatcontent").style["height"]="128px";
  273. Gdocument.getElementById("ingamechatbox").style["height"]="250px";
  274.  
  275. document.getElementById('adboxverticalCurse').style["display"] = "none";
  276. document.getElementById('adboxverticalleftCurse').style["display"] = "none";
  277.  
  278.  
  279. scope.dontswitch = false;
  280. scope.username = 0;
  281. scope.timedelay = 1400;
  282. scope.ishost = false;
  283. scope.quicki=0;
  284. scope.defaultmode = "d";
  285. scope.recmodebool = false;
  286. scope.freejoin = false;
  287. scope.beenKickedTimeStamp = 0;
  288. scope.stopquickplay = 1;
  289. scope.canceled = false;
  290. scope.banned = [];
  291. scope.transitioning = false;
  292. scope.echo_list = [];
  293. scope.message = "";
  294. scope.mode = "";
  295. scope.private_chat = "";
  296. scope.private_chat_public_key = ["",[0,0]];
  297. scope.users = [];
  298. scope.ignorepmlist = [];
  299. scope.scroll = false;
  300. scope.elem = Gdocument.getElementById("maploadwindowmapscontainer");
  301. scope.npermissions = 1;
  302. scope.space_flag = false;
  303. scope.rcaps_flag = false;
  304. scope.number_flag = false;
  305. scope.request_public_key_time_stamp = 0;
  306. scope.sandboxcopyme = false;
  307. scope.help = ["All the commands are:","/help","/?","/advhelp [command]","/space","/rcaps","/number","/echo [username]","/remove [username]","/clearecho","/chatw [username]","/msg [text]","/ignorepm [username]","/requestfake \"[mapname]\", \"[mapauthor]\"","/eval [code]","/lobby","/team [letter]","/scroll","/hidechat","/showchat","/notify","/stopnotify","Host commands are:","/startqp","/stopqp","/next","/previous","/freejoin","/start","/balanceA [number]","/rounds [number]","/ban [username]","Sandbox commands are:","/addplayer [number]","/delplayer [number]","/copyme"];
  308.  
  309. scope.adv_help = {"help":"Shows all command names.",
  310. "?":"Shows all command names.",
  311. "advhelp":"Shows a command in detail.",
  312. "space":"Toggles space. When space is on, whatever you type will be spaced apart.",
  313. "rcaps":"Toggles rcaps. When rcaps is on, each letter will randomly get capitalized.",
  314. "number":"Toggles number. When number is on, 'a' becomes 4, 'e' becomes 3, 's' becomes 5, 'o' becomes 0, 'l' and 'i' become 1.",
  315. "echo":"Echoes a username. It copies the username's chat messages.",
  316. "remove":"Removes username from echo list. You will not echo that username anymore.",
  317. "clearecho":"Clears echo list. You will not echo anyone anymore.",
  318. "chatw":"It private chats with username. Type /msg to message that username.",
  319. "msg":"Messages with what username you are chatting with. Type /chatw to chat with a username.",
  320. "ignorepm":"Ignores the username's private chat messages. To unignore, type /ignorepm [username].",
  321. "requestfake":"Requests a fake map. The host will not see the request.",
  322. "eval":"Evaluates code. Only use this if you are experienced in javascript.",
  323. "lobby":"Makes lobby visible when you are ingame. Type /lobby again to close lobby.",
  324. "team":"Joins a specific team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  325. "scroll":"Toggles a scrollbar in ingame chat.",
  326. "hidechat":"Hides ingame chat. Type /showchat to show it again.",
  327. "showchat":"Shows ingame chat. /hidechat hides the chat.",
  328. "notify":"You will be notified if a person types @MYUSERNAME",
  329. "stopnotify":"You will not be notified if a person types @MYUSERNAME",
  330. "startqp":"Starts cycling maps in your map menu.",
  331. "stopqp":"Stops cycling maps in your map menu.",
  332. "next":"Skips the map. Usable only with /startqp.",
  333. "previous":"Goes to previous map. Usable only with /startqp.",
  334. "freejoin":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing",
  335. "start":"Starts game instantly.",
  336. "balanceA":"Balances everyone with balance number.",
  337. "rounds":"Sets rounds to win.",
  338. "ban":"Bans username from lobby. If they rejoin, it automatically bans.",
  339. "addplayer":"In sandbox, it adds players.",
  340. "delplayer":"In sandbox, it deletes players.",
  341. "copyme":"In sandbox, it makes each player copy your movements."};
  342.  
  343. elem.onclick=function(e){
  344. if(stopquickplay==0 && ishost == true && e.isTrusted == true){
  345. quicki = (Array.from(e.target.parentElement.parentNode.children).indexOf(e.target.parentNode)-1)%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  346. }
  347. };
  348. scope.urlify = function(text) {
  349. return text.replace(/(?:https?:\/\/)?(?:[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)(?:\.[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)+(?:\/(?:[A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]|%[0-9a-fA-F]{2})*)?(?:\?(?:[^=]+=[^&](?:&[^=]+=[^&])*)?)?/g, function(url) {
  350. return '<a href="' + url + '" target="_blank" style = "color:orange">' + url + '</a>';
  351. })
  352. };
  353.  
  354. scope.fire = function(type,options,d = Gdocument){
  355. var event=new CustomEvent(type);
  356. for(var p in options){
  357. event[p]=options[p];
  358. }
  359. d.dispatchEvent(event);
  360. };
  361.  
  362. scope.chat = function(message){
  363. mess = Gdocument.getElementById("newbonklobby_chat_input").value;
  364. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  365. Gdocument.getElementById("newbonklobby_chat_input").value = message;
  366. Gdocument.getElementById("ingamechatinputtext").value = message;
  367. fire("keydown",{keyCode:13});
  368. fire("keydown",{keyCode:13});
  369. Gdocument.getElementById("newbonklobby_chat_input").value = mess;
  370. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  371. };
  372. scope.displayInChat = function(message, LobbyColor, InGameColor, options) {
  373. options = options ?? {};
  374. LobbyColor = LobbyColor ?? "#8800FF";
  375. InGameColor = InGameColor ?? "#AA88FF";
  376. let A = Gdocument.createElement("div");
  377. let B = Gdocument.createElement("span");
  378. B.className = "newbonklobby_chat_status";
  379. B.style.color = LobbyColor;
  380. A.appendChild(B);
  381. B.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  382. let C = Gdocument.createElement("div");
  383. let D = Gdocument.createElement("span");
  384. D.style.color = InGameColor;
  385. C.appendChild(D);
  386. D.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  387. let a = false;
  388. if(Gdocument.getElementById("newbonklobby_chat_content").scrollHeight - Gdocument.getElementById("newbonklobby_chat_content").scrollTop > Gdocument.getElementById("newbonklobby_chat_content").clientHeight - 1) {
  389. a = true;
  390. }
  391. Gdocument.getElementById("newbonklobby_chat_content").appendChild(A);
  392. Gdocument.getElementById("ingamechatcontent").appendChild(C);
  393. if (a) { Gdocument.getElementById("newbonklobby_chat_content").scrollTop = Number.MAX_SAFE_INTEGER;};
  394. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  395. };
  396.  
  397. scope.lobby = function(){
  398. if (Gdocument.getElementById("newbonklobby").style["display"]=="none"){
  399.  
  400. Gdocument.getElementById("newbonklobby_editorbutton").click();
  401. Gdocument.getElementById("mapeditor_close").click();
  402. if(Gdocument.getElementsByClassName("newbonklobby_playerentry").length>0){
  403. Gdocument.getElementById("newbonklobby").style["z-index"]=1;
  404. Gdocument.getElementById("maploadwindowcontainer").style["z-index"]=1;
  405. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=1;
  406. Gdocument.getElementById("pretty_top").style["z-index"]=2;
  407. Gdocument.getElementById("settingsContainer").style["z-index"]=2;
  408. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=2;
  409. Gdocument.getElementById("hostleaveconfirmwindow").style["z-index"]=2;
  410. }
  411. else{
  412. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  413. Gdocument.getElementById("newbonklobby").style["display"]="none";
  414. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  415. }
  416.  
  417. }
  418. else if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  419. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  420. Gdocument.getElementById("newbonklobby").style["display"]="none";
  421. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  422. }
  423. };
  424.  
  425. scope.lastmessage = function(){
  426. if(Gdocument.getElementById("newbonklobby_chat_content").children.length!=0){
  427. var lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  428. var lm2 = "";
  429. for(var i = 0; i<lm.length;i++){
  430. lm2+=" "+lm[i].textContent.trim();
  431. }
  432. lm2 = lm2.trim();
  433. if(lm2.startsWith("*")){
  434. return lm2;
  435. }
  436. }
  437. if(Gdocument.getElementById("ingamechatcontent").children.length!=0){
  438. var lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  439. var lm2 = "";
  440. for(var i = 0; i<lm.length;i++){
  441. lm2+=" "+lm[i].textContent.trim();
  442. }
  443. return lm2.trim();
  444. }
  445. return "";
  446.  
  447. };
  448. scope.map = function(e){
  449. if(e<0){
  450. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  451. quicki = 0;
  452. return;
  453. }
  454. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  455. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  456. return;
  457. }
  458.  
  459. setTimeout(function(){if(!canceled){
  460. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  461. Gdocument.getElementById("newbonklobby_editorbutton").click();
  462. Gdocument.getElementById("mapeditor_close").click();
  463. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  464. Gdocument.getElementById("mapeditor_midbox_testbutton").click();}
  465. canceled = false;
  466. transitioning = false;
  467. },timedelay);
  468.  
  469. };
  470.  
  471. scope.gotonextmap = function(e){
  472. if(e<0){
  473. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  474. quicki = 0;
  475. return;
  476. }
  477. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  478. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  479. return;
  480. }
  481. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  482. Gdocument.getElementById("newbonklobby_editorbutton").click();
  483. Gdocument.getElementById("mapeditor_close").click();
  484. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  485. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  486. Gdocument.getElementById("newbonklobby").style["visibility"] = "visible";
  487. };
  488. scope.commandhandle = function(chat_val){
  489. if (chat_val.substring(1,6)=="echo " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  490. if (chat_val.substring(6).replace(/^\s+|\s+$/g, '')==username){
  491. displayInChat("You cannot echo yourself.","#DA0808","#1EBCC1");
  492. return "";
  493. }
  494. else if (echo_list.indexOf(chat_val.substring(6).replace(/^\s+|\s+$/g, ''))===-1) {
  495.  
  496. echo_list.push(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  497. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is being echoed.","#DA0808","#1EBCC1");
  498. return "";
  499. }
  500. else{
  501. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is already being echoed.","#DA0808","#1EBCC1");
  502. return "";
  503. }
  504. }
  505. else if (chat_val.substring(1,8)=="remove " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  506. if (echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, ''))!==-1){
  507. echo_list.splice(echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, '')),1);
  508. displayInChat(chat_val.substring(7).replace(/^\s+|\s+$/g, '')+" is not being echoed.","#DA0808","#1EBCC1");
  509. return "";
  510. }
  511. else{
  512. displayInChat("You cannot remove someone that you didn't echo.","#DA0808","#1EBCC1");
  513. return "";
  514. }
  515.  
  516. }
  517. else if (chat_val.substring(1,10)=="clearecho"){
  518. echo_list = [];
  519. displayInChat("Cleared the echo list.","#DA0808","#1EBCC1");
  520. return "";
  521. }
  522. else if (chat_val.substring(1,6)=="space"){
  523. if(space_flag == true){
  524. displayInChat("Space is now off.","#DA0808","#1EBCC1");
  525. space_flag = false;
  526. }
  527. else{
  528. displayInChat("Space is now on.","#DA0808","#1EBCC1");
  529. space_flag = true;
  530. }
  531. return "";
  532. }
  533. else if (chat_val.substring(1,6)=="rcaps"){
  534. if(rcaps_flag == true){
  535. displayInChat("Rcaps is now off.","#DA0808","#1EBCC1");
  536. rcaps_flag = false;
  537. }
  538. else{
  539. displayInChat("Rcaps is now on.","#DA0808","#1EBCC1");
  540. rcaps_flag = true;
  541. }
  542.  
  543. return "";
  544. }
  545. else if (chat_val.substring(1,7)=="number"){
  546. if(number_flag == true){
  547. displayInChat("Number is now off.","#DA0808","#1EBCC1");
  548. number_flag = false;
  549. }
  550. else{
  551. displayInChat("Number is now on.","#DA0808","#1EBCC1");
  552. number_flag = true;
  553. }
  554.  
  555. return "";
  556. }
  557. else if (chat_val.substring(1,12)=="requestfake" && chat_val.replace(/^\s+|\s+$/g, '').length>=13){
  558. var mess = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  559. var result;
  560. var key;
  561. try{
  562. result = JSON.parse("{"+mess.replaceAll(",",":")+"}");
  563. if(Object.keys(result).length!=1){
  564. throw "";
  565. }
  566. else{
  567. key = Object.keys(result)[0];
  568. }
  569. SEND('42'+JSON.stringify([27,{"m":"","mapname":key.replaceAll(":",","),"mapauthor":result[key].replaceAll(":",",")}]));
  570. return "";
  571. }
  572. catch{
  573. displayInChat('Format: /requestfake "mapname", "mapauthor"',"#DA0808","#1EBCC1");
  574. return "";
  575. }
  576. return "";
  577.  
  578. }
  579. else if (chat_val.substring(1,6)=="eval " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  580. var ev = "";
  581. try{
  582. ev = eval(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  583. }
  584. catch(e){
  585. displayInChat(e.message,"#DA0808","#1EBCC1");
  586. }
  587. try{
  588. displayInChat(ev.toString(),"#DA0808","#1EBCC1");
  589. }
  590. catch{
  591. }
  592.  
  593. return "";
  594.  
  595. }
  596.  
  597. else if (chat_val.substring(1,9)=="hidechat"){
  598. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  599. return "";
  600. }
  601. else if (chat_val.substring(1,9)=="showchat"){
  602. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  603. return "";
  604. }
  605.  
  606. else if (chat_val.substring(1,7)=="scroll"){
  607. if(scroll==false){
  608. scroll = true;
  609. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="scroll";
  610. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  611. }
  612. else if(scroll==true){
  613. scroll = false;
  614. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="hidden";
  615. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  616. }
  617.  
  618. return "";
  619. }
  620.  
  621. else if (chat_val.substring(1,7)=="chatw "){
  622. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  623.  
  624. if(username == text){
  625. displayInChat("You cannot private chat with yourself.","#DA0808","#1EBCC1");
  626. return "";
  627. }
  628. private_chat = text;
  629.  
  630. SEND("42"+JSON.stringify([4,{"type":"request public key","from":username,"to":private_chat}]));
  631. request_public_key_time_stamp = Date.now();
  632. setTimeout(function(){if(private_chat_public_key[0]!=private_chat){displayInChat("Failed to connect to "+private_chat+".","#DA0808","#1EBCC1");private_chat = private_chat_public_key[0];}},1600);
  633. return "";
  634. }
  635.  
  636. else if (chat_val.substring(1,5)=="msg " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  637. if(private_chat_public_key[1][0] != 0 && private_chat_public_key[1][1] != 0 && private_chat_public_key[0] == private_chat){
  638. var text = chat_val.substring(5).replace(/^\s+|\s+$/g, '');
  639. var password = [];
  640. for(var i = 0;i<5;i++){
  641. password.push(Math.floor(Math.random()*100+50));
  642. }
  643. var text2 = [];
  644. for(var i = 0;i<text.slice(0,400).length ;i++){
  645. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  646. }
  647. SEND("42"+JSON.stringify([4,{"type":"private chat","from":username,"to":private_chat,"message":text2,"password":CRYPT_MESSAGE(private_chat_public_key[1],password)}]));
  648. displayInChat("> "+username+": "+text,"#DA0808","#1EBCC1");
  649.  
  650. }
  651. return "";
  652. }
  653. else if (chat_val.substring(1,10)=="ignorepm " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  654. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  655. if(ignorepmlist.includes(text)){
  656. var index = ignorepmlist.indexOf(text);
  657. ignorepmlist.splice(index,1);
  658. displayInChat("You are not ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  659.  
  660. }
  661. else{
  662. ignorepmlist.push(text);
  663. displayInChat("You are now ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  664. }
  665. return "";
  666. }
  667. else if (chat_val.substring(1,6)=="lobby"){
  668. lobby();
  669. return "";
  670. }
  671. else if (chat_val.substring(1,6)=="team " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  672. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  673. if(text == "r"){Gdocument.getElementById("newbonklobby_redbutton").click();}
  674. else if(text == "g"){Gdocument.getElementById("newbonklobby_greenbutton").click();}
  675. else if(text == "y"){Gdocument.getElementById("newbonklobby_yellowbutton").click();}
  676. else if(text == "b"){Gdocument.getElementById("newbonklobby_bluebutton").click();}
  677. else if(text == "s"){Gdocument.getElementById("newbonklobby_specbutton").click();}
  678. else if(text == "f"){Gdocument.getElementById("newbonklobby_ffabutton").click();}
  679. return "";
  680. }
  681. else if (chat_val.substring(1,7)=="notify"){
  682.  
  683. npermissions = 1;
  684. return "";
  685. }
  686. else if (chat_val.substring(1,11)=="stopnotify"){
  687.  
  688. npermissions = 0;
  689. return "";
  690. }
  691. else if (chat_val.substring(1,5)=="help" || chat_val.substring(1,2)=="?"){
  692. for(var i = 0;i<help.length;i++){
  693. displayInChat(help[i],"#DA0808","#1EBCC1");
  694.  
  695. }
  696. return "";
  697. }
  698. else if (chat_val.substring(1,9)=="advhelp " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  699. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  700. if(typeof(adv_help[text])!='undefined'){
  701. displayInChat(adv_help[text],"#DA0808","#1EBCC1");
  702. }
  703. return "";
  704. }
  705. else if(ishost){
  706.  
  707. if (chat_val.substring(1,5)=="next" && stopquickplay == 0){
  708. quicki++;
  709. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  710. displayInChat("Switched to next map.","#DA0808","#1EBCC1");
  711. return "";
  712.  
  713. }
  714. else if (chat_val.substring(1,9)=="freejoin"){
  715. if(freejoin == false){
  716. freejoin = true;
  717. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  718.  
  719. }
  720. else{
  721. freejoin = false;
  722. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  723. }
  724.  
  725. return "";
  726.  
  727. }
  728.  
  729. else if (chat_val.substring(1,9)=="previous" && stopquickplay == 0){
  730. quicki--;
  731. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  732.  
  733. displayInChat("Switched to previous map.","#DA0808","#1EBCC1");
  734. return "";
  735. }
  736. else if (chat_val.substring(1,6)=="start" && chat_val.length == 6){
  737. Gdocument.getElementById("newbonklobby_editorbutton").click();
  738. Gdocument.getElementById("mapeditor_close").click();
  739. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  740. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  741.  
  742. return "";
  743. }
  744.  
  745. else if (chat_val.substring(1,8)=="startqp" && stopquickplay == 1){
  746. stopquickplay = 0;
  747. quicki = 0;
  748. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  749. return "";
  750. }
  751. else if (chat_val.substring(1,7)=="stopqp" && stopquickplay == 0){
  752. stopquickplay = 1;
  753. quicki = 0;
  754. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  755. return "";
  756. }
  757.  
  758. else if (chat_val.substring(1,5)=="ban " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  759. banned.push(chat_val.substring(5).replace(/^\s+|\s+$/g, ''));
  760. displayInChat("Banned "+chat_val.substring(5).replace(/^\s+|\s+$/g, '')+".","#DA0808","#1EBCC1");
  761. return "/kick '" + chat_val.substring(5).replace(/^\s+|\s+$/g, '') + "'";
  762. }
  763. else if (chat_val.substring(1,10)=="balanceA " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  764. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  765. if(!isNaN(parseInt(text))){
  766. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  767. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  768. Gdocument.getElementById("ingamechatinputtext").value = "";
  769. Gdocument.getElementById("newbonklobby_editorbutton").click();
  770. Gdocument.getElementById("mapeditor_close").click();
  771. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  772. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  773.  
  774. }
  775. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry");
  776. for(var i = 0; i<playing.length;i++){
  777. chat("/balance \""+playing[i].children[1].textContent+"\" "+text)
  778. }
  779. }
  780. return "";
  781.  
  782. }
  783. else if (chat_val.substring(1,8)=="rounds " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  784. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  785. if(!isNaN(parseInt(text))){
  786. text = parseInt(text).toString();
  787. SEND('42[21,{"w":'+text+'}]');
  788. RECIEVE('42[27,'+text+']');
  789. }
  790. return "";
  791.  
  792. }
  793. else if (chat_val.substring(1,13)=="defaultmode " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  794. var text = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  795. if(text == "default"){
  796. defaultmode = "";
  797. displayInChat("Changed default mode to default.","#DA0808","#1EBCC1");
  798. }
  799. else if(text == "arrows"){
  800. defaultmode = "ar";
  801. displayInChat("Changed default mode to arrows.","#DA0808","#1EBCC1");
  802. }
  803. else if(text == "death arrows"){
  804. defaultmode = "ard";
  805. displayInChat("Changed default mode to death arrows.","#DA0808","#1EBCC1");
  806. }
  807. else if(text == "grapple"){
  808. defaultmode = "sp";
  809. displayInChat("Changed default mode to grapple.","#DA0808","#1EBCC1");
  810. }
  811. else if(text == "classic"){
  812. defaultmode = "b";
  813. displayInChat("Changed default mode to classic.","#DA0808","#1EBCC1");
  814.  
  815. }
  816. else{
  817. displayInChat("Default mode options:","#DA0808","#1EBCC1");
  818. displayInChat("default","#DA0808","#1EBCC1");
  819. displayInChat("classic","#DA0808","#1EBCC1");
  820. displayInChat("arrows","#DA0808","#1EBCC1");
  821. displayInChat("death arrows","#DA0808","#1EBCC1");
  822. displayInChat("grapple","#DA0808","#1EBCC1");
  823. }
  824. return "";
  825.  
  826. }
  827. else if (chat_val.substring(1,8)=="recmode"){
  828. if(recmodebool == true){
  829. recmodebool = false;
  830. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  831.  
  832. }
  833. else{
  834. recmodebool = true;
  835. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  836.  
  837. }
  838.  
  839. return "";
  840.  
  841. }
  842. else if(sandboxon){
  843. if (chat_val.substring(1,11)=="addplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  844. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  845. if(!isNaN(parseInt(text))){
  846. var text2 = parseInt(text);
  847. if(text2>0){
  848. for(var i = 0;i<text2;i++){
  849. RECIEVE('42[4,'+sandboxid+',"0123456789abcdef","'+sandboxid.toString()+'",true,0,1,{"layers":[],"bc":'+Math.floor(Math.random() * 16777215).toString()+'}]');
  850. sandboxplayerids[sandboxid] = sandboxid.toString();
  851. sandboxid+=1;
  852. }
  853.  
  854. }
  855. }
  856. return "";
  857.  
  858. }
  859. else if (chat_val.substring(1,11)=="delplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  860. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  861. if(!isNaN(parseInt(text))){
  862. var text2 = parseInt(text);
  863. if(text2>0){
  864. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden"){
  865. var jsonkeys = Object.keys(sandboxplayerids).reverse();
  866. for(var i = 0;i<text2 && i<jsonkeys.length;i++){
  867. RECIEVE('42[5,'+jsonkeys[i]+',0]');
  868. delete sandboxplayerids[jsonkeys[i]];
  869. }
  870. }
  871. else{
  872. displayInChat("Cannot delete players while ingame.","#DA0808","#1EBCC1");
  873. }
  874.  
  875. }
  876. }
  877. return "";
  878. }
  879. else if (chat_val.substring(1,7)=="copyme"){
  880. if(sandboxcopyme == true){
  881. displayInChat("Copyme is now off.","#DA0808","#1EBCC1");
  882. sandboxcopyme = false;
  883. }
  884. else{
  885. displayInChat("Copyme is now on.","#DA0808","#1EBCC1");
  886. sandboxcopyme = true;
  887. }
  888.  
  889. return "";
  890. }
  891. }
  892. }
  893. return chat_val;
  894. };
  895.  
  896. scope.flag_manage = function(t){
  897. var text = t;
  898.  
  899. if(rcaps_flag == true){
  900. text = text.split('');
  901. for(var i = 0; i<text.length;i++){
  902. if(Math.floor(Math.random()*2)){
  903. text[i] = text[i].toUpperCase();
  904. }
  905. else{
  906. text[i] = text[i].toLowerCase();
  907. }
  908. }
  909. text = text.join('');
  910. }
  911. if(space_flag == true){
  912. text = text.split('').join(' ')
  913. }
  914. if(number_flag == true){
  915. text = text.replace(/[t|T][Oo]+/g,"2");
  916. text = text.replace(/[f|F][o|O][r|R]/g,"4");
  917. text = text.replace(/[a|A][t|T][e|E]/g,"8");
  918. text = text.replace(/[e|E]/g,"3");
  919. text = text.replace(/[a|A]/g,"4");
  920. text = text.replace(/[o|O]/g,"0");
  921. text = text.replace(/[s|S]/g,"5");
  922. text = text.replace(/[i|I|l|L]/g,"1");
  923. }
  924. return text;
  925. };
  926. Gdocument.getElementById("newbonklobby_chat_input").onkeydown = function(e){
  927. if(e.keyCode==13){
  928.  
  929. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  930.  
  931. if (chat_val!="" && chat_val[0]=="/"){
  932.  
  933. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  934. chat(commandhandle(chat_val));
  935. }
  936. else{
  937. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  938. chat(flag_manage(chat_val));
  939. }
  940. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  941. if (chat_val!="" && chat_val[0]=="/"){
  942.  
  943. Gdocument.getElementById("ingamechatinputtext").value = "";
  944. chat(commandhandle(chat_val));
  945. }
  946. else{
  947. Gdocument.getElementById("ingamechatinputtext").value = "";
  948. chat(flag_manage(chat_val));
  949. }
  950.  
  951. }
  952. };
  953. Gdocument.getElementById("ingamechatinputtext").onkeydown = function(e){
  954. if(e.keyCode==13){
  955.  
  956. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  957. if (chat_val!="" && chat_val[0]=="/"){
  958.  
  959. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  960. chat(commandhandle(chat_val));
  961. }
  962. else{
  963. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  964. chat(flag_manage(chat_val));
  965. }
  966. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  967.  
  968. if (chat_val!="" && chat_val[0]=="/"){
  969.  
  970. Gdocument.getElementById("ingamechatinputtext").value = "";
  971. chat(commandhandle(chat_val));
  972. }
  973. else{
  974. Gdocument.getElementById("ingamechatinputtext").value = "";
  975. chat(flag_manage(chat_val));
  976. }
  977. }
  978. };
  979. scope.Last_message = "";
  980. scope.Laster_message = "";
  981. scope.new_message = false;
  982. scope.changed_chat = false;
  983. scope.interval = setInterval(timeout123,100);
  984. function timeout123() {
  985.  
  986. if(Gdocument.getElementById("sm_connectingContainer").style["visibility"] == "hidden"){
  987. var chatbox = Gdocument.getElementById("newbonklobby_chat_content");
  988. while (chatbox.firstChild) {
  989. chatbox.removeChild(chatbox.firstChild);
  990. }
  991. rcaps_flag = false;
  992. space_flag = false;
  993. number_flag = false;
  994. echo_list = [];
  995. scroll = false;
  996. stopquickplay = 1;
  997. freejoin = false;
  998. defaultmode = "";
  999. recmodebool = false;
  1000. playerids = {};
  1001. ishost = false;
  1002. sandboxplayerids = {};
  1003. sandboxcopyme = false;
  1004. sandboxon = false;
  1005. sandboxid = 1;
  1006.  
  1007. }
  1008. if(Gdocument.getElementById("ingametextwarning_afk").style["display"]=="table"){
  1009. Gdocument.getElementById("pretty_top_settings").click();
  1010. key2 = Gdocument.getElementById("redefineControls_table").children[0].children[5].children[1].innerHTML.charCodeAt(0);
  1011. Gdocument.getElementById("settings_close").click();
  1012.  
  1013. if(key2>0){
  1014. fire("keydown",{keyCode:key2},Gwindow);
  1015. setTimeout(function(){fire("keyup",{keyCode:key2},Gwindow)},100);
  1016. }
  1017.  
  1018. }
  1019.  
  1020. if(Gdocument.getElementById("newbonklobby").style["display"]=="block"){
  1021. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="hidden";
  1022. }
  1023. else{
  1024. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="visible";
  1025.  
  1026. }
  1027. mode = Gdocument.getElementById("newbonklobby_modetext").textContent;
  1028. var userlist = Gdocument.getElementsByClassName("newbonklobby_playerentry_name");
  1029. users = [];
  1030. for(var i = 0;i<userlist.length;i++){
  1031. users.push(userlist[i].textContent);
  1032. }
  1033. if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 0){
  1034. ishost = true;
  1035. }
  1036. else{
  1037. ishost = false;
  1038. }
  1039.  
  1040. if(Gdocument.getElementById("pretty_top_name")!=null){
  1041. username = Gdocument.getElementById("pretty_top_name").textContent;
  1042. }
  1043. try{
  1044. Last_message = lastmessage()
  1045. } catch{
  1046. Last_message = "";
  1047. }
  1048. if (Laster_message != Last_message){
  1049. Laster_message = Last_message;
  1050. if(changed_chat==false){
  1051. new_message = true;
  1052. }
  1053. else{
  1054. changed_chat = false;
  1055. }
  1056. }
  1057. if(new_message){
  1058. if(freejoin && Last_message.startsWith("* ") && Last_message.endsWith(" has joined the game") && ishost){
  1059.  
  1060. var userjoined = Last_message.substring(2,Last_message.length-20);
  1061.  
  1062. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  1063. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  1064. Gdocument.getElementById("ingamechatinputtext").value = "";
  1065. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1066. Gdocument.getElementById("mapeditor_close").click();
  1067. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1068. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  1069.  
  1070. }
  1071. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry newbonklobby_playerentry_half");
  1072. var inplaying = false;
  1073. for(var i = 0;i<playing.length;i++){
  1074. if(userjoined == playing[i].children[1].textContent){
  1075. inplaying = true;
  1076. break;
  1077. }
  1078. }
  1079.  
  1080. if(playing.length<=2 && inplaying){
  1081. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1082. Gdocument.getElementById("mapeditor_close").click();
  1083. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1084. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  1085. if(transitioning == true){
  1086. canceled = true;
  1087. }
  1088. }
  1089.  
  1090. }
  1091. var lm = "";
  1092. try{
  1093. lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  1094. if(typeof(lm[0].parentElement.style["parsed"]) == 'undefined'){
  1095. if (lm[0].className == "newbonklobby_chat_msg_colorbox"){
  1096. lm[2].innerHTML = urlify(lm[2].innerHTML);
  1097. Laster_message = lastmessage();
  1098. lm[0].parentElement.style["parsed"] = true;
  1099. }
  1100. if (lm[0].className == "newbonklobby_chat_status"){
  1101. lm[0].innerHTML = urlify(lm[0].innerHTML);
  1102. Laster_message = lastmessage();
  1103. lm[0].parentElement.style["parsed"] = true;
  1104. }
  1105. }
  1106. }
  1107. catch{
  1108. lm = "";
  1109. }
  1110.  
  1111. if(Last_message.indexOf("@"+username)!=-1 && npermissions == 1){
  1112. var n = new Notification(Last_message);
  1113. }
  1114.  
  1115. try{
  1116. lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  1117. if(typeof(lm[0].parentElement.style["parsed"])=='undefined'){
  1118. if(lm[0].className == "ingamechatname"){
  1119. lm[1].innerHTML = urlify(lm[1].innerHTML);
  1120. Laster_message = lastmessage();
  1121. lm[0].parentElement.style["parsed"] = true;
  1122. }
  1123. if(lm[0].className == ""){
  1124. lm[0].innerHTML = urlify(lm[0].innerHTML);
  1125. Laster_message = lastmessage();
  1126. lm[0].parentElement.style["parsed"] = true;
  1127. }
  1128. }
  1129. }
  1130. catch{
  1131. lm = "";
  1132. }
  1133.  
  1134. for(i=0;i<echo_list.length;i++){
  1135. if(Last_message.substring(0,echo_list[i].length+2) == echo_list[i]+": "){
  1136. message = Last_message.substring(echo_list[i].length+2);
  1137. chat(flag_manage(message));
  1138. }
  1139. }
  1140. }
  1141. if (ishost==true && new_message){
  1142. for(i=0;i<banned.length;i++){
  1143. if(Last_message == "* "+banned[i]+" has joined the game "){
  1144. chat("/kick '"+banned[i]+"'");
  1145. }
  1146. }
  1147. }
  1148. if(ishost == true && stopquickplay == 0){
  1149.  
  1150. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && stopquickplay == 0 && dontswitch == false){
  1151. quicki++;
  1152. transitioning = true;
  1153. map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  1154.  
  1155. dontswitch = true;
  1156. setTimeout(function(){Gdocument.getElementById("ingamewinner").style["visibility"]="hidden"; dontswitch = false;},timedelay);
  1157.  
  1158. }
  1159. }
  1160. new_message = false;
  1161. };
  1162. });

QingJ © 2025

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