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

QingJ © 2025

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