Bonk Commands

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

当前为 2022-09-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk Commands
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6
  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. // @license MIT
  8. // @match https://bonk.io/gameframe-release.html
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12. setTimeout(function(){
  13. var link2pastebin = "https://pastebin.com/2b8XqqYu";
  14. var link2greasyfork = "https://gf.qytechs.cn/en/scripts/451341-bonk-commands";
  15. var Gdocument = document;
  16. var Gwindow = window;
  17. if(typeof(originalSend)=='undefined'){var originalSend = Gwindow.WebSocket.prototype.send;}
  18. if(typeof(bonkwss)=='undefined'){var bonkwss = 0;}
  19. Gwindow.WebSocket.prototype.send = function(args) {
  20. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=")){window.bonkwss = this;}
  21. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=") && !this.injected){
  22. this.injected = true;
  23. var originalRecieve = this.onmessage;
  24. this.onmessage = function(args){
  25. if(args.data.startsWith('42[7')){
  26. var jsonargs = JSON.parse(args.data.substring(2))[2];
  27. if(typeof(jsonargs["type"]) != "undefined"){
  28. if(jsonargs["type"]=="private chat" && (jsonargs["to"] == username)){
  29. if(typeof(jsonargs["message"])=="object"){
  30. var decodedtext = CRYPT_MESSAGE(private_key,jsonargs["message"].slice(0,400));
  31. var encodedtext = "";
  32. for(var i=0;i<decodedtext.length;i++){
  33. encodedtext+=String.fromCharCode(decodedtext[i]);
  34. }
  35. displayInChat("> "+jsonargs["from"]+": "+encodedtext,"#DA0808","#1EBCC1");
  36. }
  37. }
  38. if(jsonargs["type"]=="request public key" && jsonargs["to"] == username){
  39. SEND("42"+JSON.stringify([4,{"type":"public key","from":username,"public key":public_key}]));
  40. }
  41. if(jsonargs["type"]=="public key" && jsonargs["from"] == private_chat && request_public_key_time_stamp+1500>Date.now()){
  42. private_chat_public_key = [private_chat,jsonargs["public key"]];
  43. displayInChat("Private chatting with "+private_chat+".","#DA0808","#1EBCC1");
  44.  
  45. }
  46.  
  47. }
  48. }
  49. return originalRecieve.call(this,args);
  50. };
  51. var originalClose = this.onclose;
  52. this.onclose = function () {
  53. window.bonkwss = 0;
  54. return originalClose.call(this);
  55. }
  56. }
  57. if(args.startsWith('42[4,')){
  58. var jsonargs = JSON.parse(args.substring(2))[1];
  59. if(typeof(jsonargs["type"]) != "undefined"){
  60. }
  61. }
  62. if(stopquickplay!=1){
  63. args = args.replace('"wl":3','"wl":999');
  64. }
  65. return originalSend.call(this,args);
  66. };
  67.  
  68.  
  69.  
  70. function SEND(args){
  71. if(bonkwss!=0){
  72. bonkwss.send(args);
  73. }
  74. }
  75.  
  76. Gdocument.getElementById("ingamechatcontent").style["pointer-events"]="all";
  77. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  78. Gdocument.getElementById("ingamechatcontent").style["height"]="128px";
  79. Gdocument.getElementById("ingamechatbox").style["height"]="250px";
  80.  
  81. setTimeout(function(){document.getElementById('adboxverticalCurse').style["display"] = "none";
  82. document.getElementById('adboxverticalleftCurse').style["display"] = "none";},3000);
  83.  
  84.  
  85. function GENERATE_PRIME_NUMBER(mini = 0,maxi = 0,choices = []){
  86. if(choices.length == 0){
  87. for(var i = mini;i<maxi+1;i++){
  88. choices.push(i);
  89. }
  90. }
  91. firstTry = choices[Math.floor(Math.random()*choices.length)];
  92. for(var i = 2; i<Math.floor(Math.sqrt(firstTry)+1);i++){
  93. if(i!=firstTry){
  94. if(firstTry%i == 0){
  95. choices.splice(choices.indexOf(firstTry),1);
  96. if(choices.length == 0){
  97. return 0;
  98. }
  99. return GENERATE_PRIME_NUMBER(mini,maxi,choices);
  100. }
  101. }
  102. }
  103. return firstTry;
  104. }
  105. function GENERATE_KEYS(){
  106. interval = [];
  107. for(var i = 750;i<3001;i++){
  108. interval.push(i);
  109. }
  110. random_prime = [GENERATE_PRIME_NUMBER(0,0,choices = interval),0];
  111. interval.splice(interval.indexOf(random_prime[0]),1);
  112. random_prime[1] = GENERATE_PRIME_NUMBER(0,0,choices = interval);
  113.  
  114. n = random_prime[0]*random_prime[1];
  115. n2 = (random_prime[0]-1)*(random_prime[1]-1);
  116.  
  117.  
  118. e = GENERATE_PRIME_NUMBER(2,n2-1);
  119. d = 0;
  120. redo = true;
  121. for(var i = 0;i<1000000;i++){
  122. if((e*i-1)%n2 == 0 && i!=e){
  123. d = i;
  124. redo = false;
  125. break;
  126. }
  127. }
  128. if(redo){
  129. return GENERATE_KEYS();
  130. }
  131. else{
  132. return [[n,e],[n,d]];
  133. }
  134.  
  135. }
  136. function CRYPT_NUMBER(key, data){
  137.  
  138. result = 1;
  139. for(var i = 0;i<key[1];i++){
  140. result*=data;
  141. result = result%key[0];
  142. }
  143. return result%key[0];
  144.  
  145. }
  146.  
  147. function CRYPT_MESSAGE(key,data){
  148. var resulttext = [];
  149. for(var i = 0;i<data.length;i++){
  150. resulttext.push(CRYPT_NUMBER(key,data[i]));
  151. }
  152. return resulttext;
  153.  
  154. }
  155.  
  156.  
  157. var dontswitch = false;
  158. var username = 0;
  159. var timedelay = 1400;
  160. var ishost = false;
  161. var quicki=0;
  162. var freejoin = false;
  163. var stopquickplay = 1;
  164. var canceled = false;
  165. var banned = [];
  166. var transitioning = false;
  167. var echo_list = [];
  168. var message = "";
  169. var mode = "";
  170. var private_chat = "";
  171. var private_chat_public_key = ["",[0,0]];
  172. var users = [];
  173. var scroll = false;
  174. var elem = Gdocument.getElementById("maploadwindowmapscontainer");
  175. var npermissions = 1;
  176. var space_flag = false;
  177. var rcaps_flag = false;
  178. var number_flag = false;
  179. var private_chat_keys = GENERATE_KEYS();
  180. var private_key = private_chat_keys[0];
  181. var public_key = private_chat_keys[1];
  182. var request_public_key_time_stamp = 0;
  183. elem.onclick=function(e){
  184. if(stopquickplay==0 && ishost == true && e.isTrusted == true){
  185. quicki = (Array.from(e.target.parentElement.parentNode.children).indexOf(e.target.parentNode)-1)%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  186. }
  187. };
  188. function urlify(text) {
  189. return text.replace(/(?:https?:\/\/)?(?:[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)(?:\.[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)+(?:\/(?:[A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]|%[0-9a-fA-F]{2})*)?(?:\?(?:[^=]+=[^&](?:&[^=]+=[^&])*)?)?/g, function(url) {
  190. return '<a href="' + url + '" target="_blank" style = "color:orange">' + url + '</a>';
  191. })
  192. }
  193.  
  194.  
  195. function fire(type,options,d = Gdocument){
  196. var event=new CustomEvent(type);
  197. for(var p in options){
  198. event[p]=options[p];
  199. }
  200. d.dispatchEvent(event);
  201. }
  202.  
  203.  
  204. function chat(message){
  205. mess = Gdocument.getElementById("newbonklobby_chat_input").value;
  206. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  207. Gdocument.getElementById("newbonklobby_chat_input").value = message;
  208. Gdocument.getElementById("ingamechatinputtext").value = message;
  209. fire("keydown",{keyCode:13});
  210. fire("keydown",{keyCode:13});
  211. Gdocument.getElementById("newbonklobby_chat_input").value = mess;
  212. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  213. }
  214. function displayInChat(message, LobbyColor, InGameColor, options) {
  215. options = options ?? {};
  216. LobbyColor = LobbyColor ?? "#8800FF";
  217. InGameColor = InGameColor ?? "#AA88FF";
  218. let A = Gdocument.createElement("div");
  219. let B = Gdocument.createElement("span");
  220. B.className = "newbonklobby_chat_status";
  221. B.style.color = LobbyColor;
  222. A.appendChild(B);
  223. B.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  224. let C = Gdocument.createElement("div");
  225. let D = Gdocument.createElement("span");
  226. D.style.color = InGameColor;
  227. C.appendChild(D);
  228. D.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  229. let a = false;
  230. if(Gdocument.getElementById("newbonklobby_chat_content").scrollHeight - Gdocument.getElementById("newbonklobby_chat_content").scrollTop > Gdocument.getElementById("newbonklobby_chat_content").clientHeight - 1) {
  231. a = true;
  232. }
  233. Gdocument.getElementById("newbonklobby_chat_content").appendChild(A);
  234. Gdocument.getElementById("ingamechatcontent").appendChild(C);
  235. if (a) { Gdocument.getElementById("newbonklobby_chat_content").scrollTop = Number.MAX_SAFE_INTEGER;};
  236. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  237. }
  238.  
  239.  
  240. function lobby(){
  241. if (Gdocument.getElementById("newbonklobby").style["display"]=="none"){
  242. Gdocument.getElementById("mapeditorcontainer").click();
  243. Gdocument.getElementById("mapeditor_close").click();
  244. if(Gdocument.getElementsByClassName("newbonklobby_playerentry").length>0){
  245. Gdocument.getElementById("newbonklobby").style["opacity"]=1;
  246. Gdocument.getElementById("newbonklobby").style["display"]="block";
  247. Gdocument.getElementById("newbonklobby").style["z-index"]=1;
  248. Gdocument.getElementById("maploadwindowcontainer").style["z-index"]=1;
  249. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=1;
  250. Gdocument.getElementById("pretty_top").style["z-index"]=2;
  251. Gdocument.getElementById("settingsContainer").style["z-index"]=2;
  252. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=2;
  253. Gdocument.getElementById("hostleaveconfirmwindow").style["z-index"]=2;
  254. }
  255. else{
  256. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  257. Gdocument.getElementById("newbonklobby").style["display"]="none";
  258. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  259. }
  260. }
  261. else if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  262. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  263. Gdocument.getElementById("newbonklobby").style["display"]="none";
  264. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  265. }
  266. }
  267.  
  268. function lastmessage(){
  269. if(Gdocument.getElementById("newbonklobby_chat_content").children.length!=0){
  270. var lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  271. var lm2 = "";
  272. for(var i = 0; i<lm.length;i++){
  273. lm2+=" "+lm[i].textContent.trim();
  274. }
  275. lm2 = lm2.trim();
  276. if(lm2.startsWith("*")){
  277. return lm2;
  278. }
  279. }
  280. if(Gdocument.getElementById("ingamechatcontent").children.length!=0){
  281. var lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  282. var lm2 = "";
  283. for(var i = 0; i<lm.length;i++){
  284. lm2+=" "+lm[i].textContent.trim();
  285. }
  286. return lm2.trim();
  287. }
  288. return "";
  289.  
  290. }
  291. function map(e){
  292. if(e<0){
  293. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  294. quicki = 0;
  295. return;
  296. }
  297. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  298. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  299. return;
  300. }
  301. setTimeout(function(){if(!canceled){
  302. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  303. Gdocument.getElementById("newbonklobby_editorbutton").click();
  304. Gdocument.getElementById("mapeditor_close").click();
  305. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  306. Gdocument.getElementById("mapeditor_midbox_testbutton").click();}
  307. canceled = false;
  308. transitioning = false;
  309. },timedelay);
  310. }
  311.  
  312. function gotonextmap(e){
  313. if(e<0){
  314. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  315. quicki = 0;
  316. return;
  317. }
  318. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  319. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  320. return;
  321. }
  322. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  323. Gdocument.getElementById("newbonklobby_editorbutton").click();
  324. Gdocument.getElementById("mapeditor_close").click();
  325. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  326. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  327. Gdocument.getElementById("newbonklobby").style["visibility"] = "visible";
  328.  
  329. }
  330. function commandhandle(chat_val){
  331. if (chat_val.substring(1,6)=="echo " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  332. if (chat_val.substring(6).replace(/^\s+|\s+$/g, '')==username){
  333. displayInChat("You cannot echo yourself.","#DA0808","#1EBCC1");
  334. return "";
  335. }
  336. else if (echo_list.indexOf(chat_val.substring(6).replace(/^\s+|\s+$/g, ''))===-1) {
  337. echo_list.push(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  338. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is being echoed.","#DA0808","#1EBCC1");
  339. return "";
  340. }
  341. else{
  342. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is already being echoed.","#DA0808","#1EBCC1");
  343. return "";
  344. }
  345. }
  346. else if (chat_val.substring(1,8)=="remove " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  347. if (echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, ''))!==-1){
  348. echo_list.splice(echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, '')),1);
  349. displayInChat(chat_val.substring(7).replace(/^\s+|\s+$/g, '')+" is not being echoed.","#DA0808","#1EBCC1");
  350. return "";
  351. }
  352. else{
  353. displayInChat("You cannot remove someone that you didn't echo.","#DA0808","#1EBCC1");
  354. return "";
  355. }
  356. }
  357. else if (chat_val.substring(1,10)=="clearecho"){
  358. echo_list = [];
  359. displayInChat("Cleared the echo list.","#DA0808","#1EBCC1");
  360. return "";
  361. }
  362. else if (chat_val.substring(1,6)=="space"){
  363. if(space_flag == true){
  364. displayInChat("Space is now off.","#DA0808","#1EBCC1");
  365. space_flag = false;
  366. }
  367. else{
  368. displayInChat("Space is now on.","#DA0808","#1EBCC1");
  369. space_flag = true;
  370. }
  371. return "";
  372. }
  373. else if (chat_val.substring(1,6)=="rcaps"){
  374. if(rcaps_flag == true){
  375. displayInChat("Rcaps is now off.","#DA0808","#1EBCC1");
  376. rcaps_flag = false;
  377. }
  378. else{
  379. displayInChat("Rcaps is now on.","#DA0808","#1EBCC1");
  380. rcaps_flag = true;
  381. }
  382. return "";
  383. }
  384. else if (chat_val.substring(1,7)=="number"){
  385. if(number_flag == true){
  386. displayInChat("Number is now off.","#DA0808","#1EBCC1");
  387. number_flag = false;
  388. }
  389. else{
  390. displayInChat("Number is now on.","#DA0808","#1EBCC1");
  391. number_flag = true;
  392. }
  393. return "";
  394. }
  395. else if (chat_val.substring(1,12)=="requestfake" && chat_val.replace(/^\s+|\s+$/g, '').length>=13){
  396. var mess = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  397. var result;
  398. var key;
  399. try{
  400. result = JSON.parse("{"+mess.replaceAll(",",":")+"}");
  401. if(Object.keys(result).length!=1){
  402. throw "";
  403. }
  404. else{
  405. key = Object.keys(result)[0];
  406. }
  407. SEND('42'+JSON.stringify([27,{"m":"","mapname":key.replaceAll(":",","),"mapauthor":result[key].replaceAll(":",",")}]));
  408. return "";
  409. }
  410. catch{
  411. displayInChat('Format: /requestfake "mapname", "mapauthor"',"#DA0808","#1EBCC1");
  412. return "";
  413. }
  414. return "";
  415. }
  416. else if (chat_val.substring(1,6)=="eval " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  417. var ev = "";
  418. try{
  419. ev = eval(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  420. }
  421. catch(e){
  422. displayInChat(e.message,"#DA0808","#1EBCC1");
  423. }
  424. try{
  425. displayInChat(ev.toString(),"#DA0808","#1EBCC1");
  426. }
  427. catch{
  428. }
  429. return "";
  430. }
  431. else if (chat_val.substring(1,9)=="hidechat"){
  432. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  433. return "";
  434. }
  435. else if (chat_val.substring(1,9)=="showchat"){
  436. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  437. return "";
  438. }
  439. else if (chat_val.substring(1,7)=="scroll"){
  440. if(scroll==false){
  441. scroll = true;
  442. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="scroll";
  443. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  444. }
  445. else if(scroll==true){
  446. scroll = false;
  447. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="hidden";
  448. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  449. }
  450. return "";
  451. }
  452.  
  453. else if (chat_val.substring(1,7)=="chatw "){
  454. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  455. if(username == text){
  456. displayInChat("You cannot private chat with yourself.","#DA0808","#1EBCC1");
  457. return "";
  458. }
  459. private_chat = text;
  460. SEND("42"+JSON.stringify([4,{"type":"request public key","from":username,"to":private_chat}]));
  461. request_public_key_time_stamp = Date.now();
  462. 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);
  463. return "";
  464. }
  465. else if (chat_val.substring(1,5)=="msg " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  466. if(private_chat_public_key[1][0] != 0 && private_chat_public_key[1][1] != 0 && private_chat_public_key[0] == private_chat){
  467. var text = chat_val.substring(5).replace(/^\s+|\s+$/g, '');
  468. var text2 = [];
  469. for(var i = 0;i<text.slice(0,400).length ;i++){
  470. text2.push(text.slice(0,400).charCodeAt(i));
  471. }
  472. SEND("42"+JSON.stringify([4,{"type":"private chat","from":username,"to":private_chat,"message":CRYPT_MESSAGE(private_chat_public_key[1],text2)}]));
  473. displayInChat("> "+username+": "+text,"#DA0808","#1EBCC1");
  474.  
  475. }
  476. return "";
  477. }
  478. else if (chat_val.substring(1,6)=="lobby"){
  479. lobby();
  480. return "";
  481. }
  482. else if (chat_val.substring(1,6)=="team " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  483. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  484. if(text == "r"){Gdocument.getElementById("newbonklobby_redbutton").click();}
  485. else if(text == "g"){Gdocument.getElementById("newbonklobby_greenbutton").click();}
  486. else if(text == "y"){Gdocument.getElementById("newbonklobby_yellowbutton").click();}
  487. else if(text == "b"){Gdocument.getElementById("newbonklobby_bluebutton").click();}
  488. else if(text == "s"){Gdocument.getElementById("newbonklobby_specbutton").click();}
  489. else if(text == "f"){Gdocument.getElementById("newbonklobby_ffabutton").click();}
  490. return "";
  491. }
  492. else if (chat_val.substring(1,7)=="notify"){
  493. npermissions = 1;
  494. return "";
  495. }
  496. else if (chat_val.substring(1,11)=="stopnotify"){
  497. npermissions = 0;
  498. return "";
  499. }
  500. else if (chat_val.substring(1,5)=="help" || chat_val.substring(1,2)=="?"){
  501. displayInChat("All the commands are:","#DA0808","#1EBCC1");
  502. displayInChat("/help","#DA0808","#1EBCC1");
  503. displayInChat("/?","#DA0808","#1EBCC1");
  504. displayInChat("/space","#DA0808","#1EBCC1");
  505. displayInChat("/rcaps","#DA0808","#1EBCC1");
  506. displayInChat("/number","#DA0808","#1EBCC1");
  507. displayInChat("/echo [username]","#DA0808","#1EBCC1");
  508. displayInChat("/remove [username]","#DA0808","#1EBCC1");
  509. displayInChat("/clearecho","#DA0808","#1EBCC1");
  510. displayInChat("/chatw [username]","#DA0808","#1EBCC1");
  511. displayInChat("/msg [text]","#DA0808","#1EBCC1");
  512. displayInChat("/requestfake \"[mapname]\", \"[mapauthor]\"","#DA0808","#1EBCC1");
  513. displayInChat("/eval [code]","#DA0808","#1EBCC1");
  514. displayInChat("/lobby","#DA0808","#1EBCC1");
  515. displayInChat("/team [letter]","#DA0808","#1EBCC1");
  516. displayInChat("/scroll","#DA0808","#1EBCC1");
  517. displayInChat("/hidechat","#DA0808","#1EBCC1");
  518. displayInChat("/showchat","#DA0808","#1EBCC1");
  519. displayInChat("/notify","#DA0808","#1EBCC1");
  520. displayInChat("/stopnotify","#DA0808","#1EBCC1");
  521. displayInChat("Host commands are:","#DA0808","#1EBCC1");
  522. displayInChat("/startqp","#DA0808","#1EBCC1");
  523. displayInChat("/stopqp","#DA0808","#1EBCC1");
  524. displayInChat("/next","#DA0808","#1EBCC1");
  525. displayInChat("/previous","#DA0808","#1EBCC1");
  526. displayInChat("/start","#DA0808","#1EBCC1");
  527. displayInChat("/ban [username]","#DA0808","#1EBCC1");
  528. return "";
  529. }
  530. else if(ishost){
  531. if (chat_val.substring(1,5)=="next" && stopquickplay == 0){
  532. quicki++;
  533. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  534. displayInChat("Switched to next map.","#DA0808","#1EBCC1");
  535. return "";
  536.  
  537. }
  538. else if (chat_val.substring(1,9)=="freejoin"){
  539. if(freejoin == false){
  540. freejoin = true;
  541. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  542.  
  543. }
  544. else{
  545. freejoin = false;
  546. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  547. }
  548. return "";
  549.  
  550. }
  551. else if (chat_val.substring(1,9)=="previous" && stopquickplay == 0){
  552. quicki--;
  553. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  554. displayInChat("Switched to previous map.","#DA0808","#1EBCC1");
  555. return "";
  556. }
  557. else if (chat_val.substring(1,6)=="start" && chat_val.length == 6){
  558. Gdocument.getElementById("newbonklobby_editorbutton").click();
  559. Gdocument.getElementById("mapeditor_close").click();
  560. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  561. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  562. return "";
  563. }
  564. else if (chat_val.substring(1,8)=="startqp" && stopquickplay == 1){
  565. stopquickplay = 0;
  566. quicki = 0;
  567. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  568. return "";
  569. }
  570. else if (chat_val.substring(1,7)=="stopqp" && stopquickplay == 0){
  571. stopquickplay = 1;
  572. quicki = 0;
  573. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  574. return "";
  575. }
  576.  
  577. else if (chat_val.substring(1,5)=="ban " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  578. banned.push(chat_val.substring(5).replace(/^\s+|\s+$/g, ''));
  579. displayInChat("Banned "+chat_val.substring(5).replace(/^\s+|\s+$/g, '')+".","#DA0808","#1EBCC1");
  580. return "/kick '" + chat_val.substring(5).replace(/^\s+|\s+$/g, '') + "'";
  581. }
  582. }
  583. return chat_val;
  584. }
  585. function flag_manage(t){
  586. var text = t;
  587. if(rcaps_flag == true){
  588. text = text.split('');
  589. for(var i = 0; i<text.length;i++){
  590. if(Math.floor(Math.random()*2)){
  591. text[i] = text[i].toUpperCase();
  592. }
  593. else{
  594. text[i] = text[i].toLowerCase();
  595. }
  596. }
  597. text = text.join('');
  598. }
  599. if(space_flag == true){
  600. text = text.split('').join(' ')
  601. }
  602. if(number_flag == true){
  603. text = text.replace(/[t|T][Oo]+/g,"2");
  604. text = text.replace(/[f|F][o|O][r|R]/g,"4");
  605. text = text.replace(/[a|A][t|T][e|E]/g,"8");
  606. text = text.replace(/[e|E]/g,"3");
  607. text = text.replace(/[a|A]/g,"4");
  608. text = text.replace(/[o|O]/g,"0");
  609. text = text.replace(/[s|S]/g,"5");
  610. text = text.replace(/[i|I|l|L]/g,"1");
  611. }
  612. return text;
  613. }
  614. (function(){
  615. var newbonklobby_chat_input_old = Gdocument.getElementById("newbonklobby_chat_input").onkeydown ?? (function(){});
  616. Gdocument.getElementById("newbonklobby_chat_input").onkeydown = function(e){
  617. newbonklobby_chat_input_old(e);
  618. if(e.keyCode==13){
  619. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  620. if (chat_val!="" && chat_val[0]=="/"){
  621. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  622. chat(commandhandle(chat_val));
  623. }
  624. else{
  625. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  626. chat(flag_manage(chat_val));
  627. }
  628. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  629. if (chat_val!="" && chat_val[0]=="/"){
  630. Gdocument.getElementById("ingamechatinputtext").value = "";
  631. chat(commandhandle(chat_val));
  632. }
  633. else{
  634. Gdocument.getElementById("ingamechatinputtext").value = "";
  635. chat(flag_manage(chat_val));
  636. }
  637. }
  638. }
  639. })();
  640. (function(){
  641. var ingame_chat_input_old = Gdocument.getElementById("ingamechatinputtext").onkeydown ?? (function(){});
  642. Gdocument.getElementById("ingamechatinputtext").onkeydown = function(e){
  643. ingame_chat_input_old(e);
  644. if(e.keyCode==13){
  645. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  646. if (chat_val!="" && chat_val[0]=="/"){
  647. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  648. chat(commandhandle(chat_val));
  649. }
  650. else{
  651. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  652. chat(flag_manage(chat_val));
  653. }
  654. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  655. if (chat_val!="" && chat_val[0]=="/"){
  656. Gdocument.getElementById("ingamechatinputtext").value = "";
  657. chat(commandhandle(chat_val));
  658. }
  659. else{
  660. Gdocument.getElementById("ingamechatinputtext").value = "";
  661. chat(flag_manage(chat_val));
  662. }
  663. }
  664. }
  665. })();
  666. Last_message = "";
  667. Laster_message = "";
  668. var new_message = false;
  669. var changed_chat = false;
  670. interval = setInterval(timeout123,100);
  671. function timeout123() {
  672. if(Gdocument.getElementById("mainmenuelements").style["display"] == "block"){
  673. var chatbox = Gdocument.getElementById("newbonklobby_chat_content");
  674. while (chatbox.firstChild) {
  675. chatbox.removeChild(chatbox.firstChild);
  676. }
  677. rcaps_flag = false;
  678. space_flag = false;
  679. number_flag = false;
  680. echo_list = [];
  681. scroll = false;
  682. stopquickplay = 1;
  683. freejoin = false;
  684.  
  685. }
  686. if(Gdocument.getElementById("ingametextwarning_afk").style["display"]=="table"){
  687. Gdocument.getElementById("pretty_top_settings").click();
  688. key2 = Gdocument.getElementById("redefineControls_table").children[0].children[5].children[1].innerHTML.charCodeAt(0);
  689. Gdocument.getElementById("settings_close").click();
  690.  
  691. if(key2>0){
  692. fire("keydown",{keyCode:key2},Gwindow);
  693. setTimeout(function(){fire("keyup",{keyCode:key2},Gwindow)},100);
  694. }
  695. }
  696. if(Gdocument.getElementById("newbonklobby").style["display"]=="block"){
  697. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="hidden";
  698. }
  699. else{
  700. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="visible";
  701.  
  702. }
  703. mode = Gdocument.getElementById("newbonklobby_modetext").textContent;
  704. var userlist = Gdocument.getElementsByClassName("newbonklobby_playerentry_name");
  705. users = [];
  706. for(var i = 0;i<userlist.length;i++){
  707. users.push(userlist[i].textContent);
  708. }
  709. if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 0){
  710. ishost = true;
  711. }
  712. else if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 4){
  713. ishost = false;
  714. }
  715. if(Gdocument.getElementById("pretty_top_name")!=null){
  716. username = Gdocument.getElementById("pretty_top_name").textContent;
  717. }
  718. try{
  719. Last_message = lastmessage()
  720. } catch{
  721. Last_message = "";
  722. }
  723. if (Laster_message != Last_message){
  724. Laster_message = Last_message;
  725. if(changed_chat==false){
  726. new_message = true;
  727. }
  728. else{
  729. changed_chat = false;
  730. }
  731. }
  732. if(new_message){
  733. if(freejoin && Last_message.startsWith("* ") && Last_message.endsWith(" has joined the game") && ishost){
  734. var userjoined = Last_message.substring(2,Last_message.length-20);
  735. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  736. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  737. Gdocument.getElementById("ingamechatinputtext").value = "";
  738. Gdocument.getElementById("newbonklobby_editorbutton").click();
  739. Gdocument.getElementById("mapeditor_close").click();
  740. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  741. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  742.  
  743. }
  744. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry newbonklobby_playerentry_half");
  745. var inplaying = false;
  746. for(var i = 0;i<playing.length;i++){
  747. if(userjoined == playing[i].children[1].textContent){
  748. inplaying = true;
  749. break;
  750. }
  751. }
  752. if(playing.length<=2 && inplaying){
  753. Gdocument.getElementById("newbonklobby_editorbutton").click();
  754. Gdocument.getElementById("mapeditor_close").click();
  755. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  756. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  757. if(transitioning == true){
  758. canceled = true;
  759. }
  760. }
  761. }
  762. var lm = "";
  763. try{
  764. lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  765. if (lm[0].className == "newbonklobby_chat_msg_colorbox"){
  766. lm[2].innerHTML = urlify(lm[2].innerHTML);
  767. Laster_message = lastmessage();
  768. }
  769. if (lm[0].className == "newbonklobby_chat_status"){
  770. lm[0].innerHTML = urlify(lm[0].innerHTML);
  771. Laster_message = lastmessage();
  772. }
  773. }
  774. catch{
  775. lm = "";
  776. }
  777. if(Last_message.indexOf("@"+username)!=-1 && npermissions == 1){
  778. var n = new Notification(Last_message);
  779. }
  780. try{
  781. lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  782. if(lm[0].className == "ingamechatname"){
  783. lm[1].innerHTML = urlify(lm[1].innerHTML);
  784. Laster_message = lastmessage();
  785. }
  786. if(lm[0].className == ""){
  787. lm[0].innerHTML = urlify(lm[0].innerHTML);
  788. Laster_message = lastmessage();
  789. }
  790. }
  791. catch{
  792. lm = "";
  793. }
  794.  
  795. for(i=0;i<echo_list.length;i++){
  796. if(Last_message.substring(0,echo_list[i].length+2) == echo_list[i]+": "){
  797. message = Last_message.substring(echo_list[i].length+2);
  798. chat(flag_manage(message));
  799. }
  800. }
  801. }
  802. if (ishost==true && new_message){
  803. for(i=0;i<banned.length;i++){
  804. if(Last_message == "* "+banned[i]+" has joined the game "){
  805. chat("/kick '"+banned[i]+"'");
  806. }
  807. }
  808. }
  809. if(ishost == true && stopquickplay == 0){
  810. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && stopquickplay == 0 && dontswitch == false){
  811. quicki++;
  812. transitioning = true;
  813. map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  814. dontswitch = true;
  815. setTimeout(function(){Gdocument.getElementById("ingamewinner").style["visibility"]="hidden"; dontswitch = false;},timedelay);
  816. }
  817. }
  818. new_message = false;
  819. }
  820.  
  821. },5000)

QingJ © 2025

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