Bonk Commands

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

当前为 2022-12-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk Commands
  3. // @namespace https://gf.qytechs.cn/en/scripts/451341-bonk-commands
  4. // @version 9.2
  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. function BonkCommandsScriptInjector(f){
  13. if(window.location == window.parent.location){
  14. if(document.readyState == "complete"){f();}
  15. else{document.addEventListener('readystatechange',function(){setTimeout(f,1500);});}
  16. }
  17. }
  18.  
  19. BonkCommandsScriptInjector(function(){
  20. var scope = window;
  21.  
  22. scope.Gwindow = document.getElementById("maingameframe").contentWindow;
  23. scope.Gdocument = document.getElementById("maingameframe").contentDocument;
  24. Gwindow.Gwindow = window;
  25. Gwindow.Gdocument = document;
  26.  
  27. scope.link2pastebin = "https://pastebin.com/2b8XqqYu";
  28. scope.link2greasyfork = "https://gf.qytechs.cn/en/scripts/451341-bonk-commands";
  29.  
  30. if(typeof(scope.injectedBonkCommandsScript)=='undefined'){
  31. scope.injectedBonkCommandsScript = true;
  32. }
  33. else{
  34. for (var i = 0; i < 100000; i++){
  35. clearInterval(i);
  36. }
  37. }
  38. scope.GENERATE_COPRIME_NUMBER = function(mini = 0,maxi = 0,coprimewith = 0,choices = []){
  39. if(choices.length == 0){
  40. for(var i = mini;i<maxi+1;i++){
  41. choices.push(i);
  42. }
  43. }
  44. firstTry = choices[Math.floor(Math.random()*choices.length)];
  45. for(var i = 2; i<firstTry+1;i++){
  46. if(firstTry%i == 0 && coprimewith%i == 0){
  47. choices.splice(choices.indexOf(firstTry),1);
  48. if(choices.length == 0){
  49. return 0;
  50. }
  51. return GENERATE_COPRIME_NUMBER(mini,maxi,coprimewith,choices);
  52. }
  53. }
  54. return firstTry;
  55. };
  56. scope.GENERATE_PRIME_NUMBER = function(mini = 0,maxi = 0,choices = []){
  57. if(choices.length == 0){
  58. for(var i = mini;i<maxi+1;i++){
  59. choices.push(i);
  60. }
  61. }
  62. firstTry = choices[Math.floor(Math.random()*choices.length)];
  63. for(var i = 2; i<Math.floor(Math.sqrt(firstTry)+1);i++){
  64. if(i!=firstTry){
  65. if(firstTry%i == 0){
  66. choices.splice(choices.indexOf(firstTry),1);
  67. if(choices.length == 0){
  68. return 0;
  69. }
  70. return GENERATE_PRIME_NUMBER(mini,maxi,choices);
  71. }
  72. }
  73. }
  74. return firstTry;
  75. };
  76.  
  77. scope.GENERATE_KEYS = function(){
  78. interval = [];
  79. for(var i = 100;i<301;i++){
  80. interval.push(i);
  81. }
  82. random_prime = [GENERATE_PRIME_NUMBER(0,0,choices = interval),0];
  83. interval.splice(interval.indexOf(random_prime[0]),1);
  84. random_prime[1] = GENERATE_PRIME_NUMBER(0,0,choices = interval);
  85.  
  86. n = random_prime[0]*random_prime[1];
  87. n2 = (random_prime[0]-1)*(random_prime[1]-1);
  88.  
  89. e = GENERATE_COPRIME_NUMBER(2,n2-1,n2);
  90. d = 0;
  91. redo = true;
  92. for(var i = 0;i<1000000;i++){
  93. if((e*i-1)%n2 == 0 && i!=e){
  94. d = i;
  95. redo = false;
  96. break;
  97. }
  98. }
  99. if(redo){
  100. return GENERATE_KEYS();
  101. }
  102. else{
  103. return [[n,e],[n,d]];
  104. }
  105.  
  106. };
  107. scope.CRYPT_NUMBER = function(key, data){
  108.  
  109. result = 1;
  110.  
  111. for(var i = 0;i<key[1];i++){
  112. result*=data;
  113. result = result%key[0];
  114. }
  115. return result%key[0];
  116.  
  117. };
  118.  
  119. scope.CRYPT_MESSAGE = function(key,data){
  120. var resulttext = [];
  121. for(var i = 0;i<data.length;i++){
  122. resulttext.push(CRYPT_NUMBER(key,data[i]));
  123. }
  124. return resulttext;
  125.  
  126. };
  127. if(typeof(scope.textdecoder)=='undefined'){scope.textdecoder = new Gwindow.TextDecoder;}
  128. if(typeof(scope.textencoder)=='undefined'){scope.textencoder = new Gwindow.TextEncoder;}
  129.  
  130. class bytebuffer2 {
  131. static registerClassAlias(V56, r4t) {
  132. var w1F = [arguments];
  133. w1F[9] = -830329335;
  134. w1F[3] = 789050911;
  135. w1F[1] = 2;
  136. for (
  137. w1F[6] = 1;
  138. J4z.D68(w1F[6].toString(), w1F[6].toString().length, 58391) !==
  139. w1F[9];
  140. w1F[6]++
  141. ) {
  142. w1F[1] += 2;
  143. }
  144. if (
  145. J4z.v72(w1F[1].toString(), w1F[1].toString().length, 89757) !==
  146. w1F[3]
  147. ) {
  148. }
  149. r5P.aliases[w1F[0][0]] = w1F[0][1];
  150. return w1F[0][0];
  151. }
  152. constructor() {
  153. var g1d = [arguments];
  154. this.index = 0;
  155. this.buffer = new ArrayBuffer(100*1024);
  156. this.view = new DataView(this.buffer);
  157. this.implicitClassAliasArray = [];
  158. this.implicitStringArray = [];
  159. this.bodgeCaptureZoneDataIdentifierArray = [];
  160. }
  161. readByte() {
  162. var N0H = [arguments];
  163. N0H[4] = this.view.getUint8(this.index);
  164. this.index += 1;
  165. return N0H[4];
  166. }
  167. writeByte(z0w) {
  168. var v8$ = [arguments];
  169. this.view.setUint8(this.index, v8$[0][0]);
  170. this.index += 1;
  171. }
  172. readInt() {
  173. var A71 = [arguments];
  174. A71[6] = this.view.getInt32(this.index);
  175. this.index += 4;
  176. return A71[6];
  177. }
  178. writeInt(W6i) {
  179. var p5u = [arguments];
  180. this.view.setInt32(this.index, p5u[0][0]);
  181. this.index += 4;
  182. }
  183. readShort() {
  184. var R1R = [arguments];
  185. R1R[9] = this.view.getInt16(this.index);
  186. this.index += 2;
  187. return R1R[9];
  188. }
  189. writeShort(H8B) {
  190. var d_3 = [arguments];
  191. this.view.setInt16(this.index, d_3[0][0]);
  192. this.index += 2;
  193. }
  194. readUShort() {
  195. var G0c = [arguments];
  196. G0c[2] = this.view.getUint16(this.index);
  197. this.index += 2;
  198. return G0c[2];
  199. }
  200. writeUShort(S6G) {
  201. var t7M = [arguments];
  202. this.view.setUint16(this.index, t7M[0][0]);
  203. this.index += 2;
  204. }
  205. readUint() {
  206. var W2$ = [arguments];
  207. W2$[8] = this.view.getUint32(this.index);
  208. this.index += 4;
  209. return W2$[8];
  210. }
  211. writeUint(B2X) {
  212. var f8B = [arguments];
  213. this.view.setUint32(this.index, f8B[0][0]);
  214. this.index += 4;
  215. }
  216. rewind() {
  217. var f7i = [arguments];
  218. this.index = 0;
  219. }
  220. readBoolean() {
  221. var h6P = [arguments];
  222. h6P[6] = this.readByte();
  223. return h6P[6] == 1;
  224. }
  225. writeBoolean(Y3I) {
  226. var l79 = [arguments];
  227. if (l79[0][0]) {
  228. this.writeByte(1);
  229. } else {
  230. this.writeByte(0);
  231. }
  232. }
  233. readDouble() {
  234. var V60 = [arguments];
  235. V60[4] = this.view.getFloat64(this.index);
  236. this.index += 8;
  237. return V60[4];
  238. }
  239. writeDouble(z4Z) {
  240. var O41 = [arguments];
  241. this.view.setFloat64(this.index, O41[0][0]);
  242. this.index += 8;
  243. }
  244. readFloat() {
  245. var I0l = [arguments];
  246. I0l[5] = this.view.getFloat32(this.index);
  247. this.index += 4;
  248. return I0l[5];
  249. }
  250. writeFloat(y4B) {
  251. var B0v = [arguments];
  252. this.view.setFloat32(this.index, B0v[0][0]);
  253. this.index += 4;
  254. }
  255. readUTF() {
  256. var d6I = [arguments];
  257. d6I[8] = this.readByte();
  258. d6I[7] = this.readByte();
  259. d6I[9] = d6I[8] * 256 + d6I[7];
  260. d6I[1] = new Uint8Array(d6I[9]);
  261. for (d6I[6] = 0; d6I[6] < d6I[9]; d6I[6]++) {
  262. d6I[1][d6I[6]] = this.readByte();
  263. }
  264. return textdecoder.decode(d6I[1]);
  265. }
  266. writeUTF(L3Z) {
  267. var Z75 = [arguments];
  268. Z75[4] = textencoder.encode(Z75[0][0]);
  269. Z75[3] = Z75[4].length;
  270. Z75[5] = Math.floor(Z75[3]/256);
  271. Z75[8] = Z75[3] % 256;
  272. this.writeByte(Z75[5]);
  273. this.writeByte(Z75[8]);
  274. Z75[7] = this;
  275. Z75[4].forEach(I_O);
  276. function I_O(s0Q, H4K, j$o) {
  277. var N0o = [arguments];
  278. Z75[7].writeByte(N0o[0][0]);
  279. }
  280. }
  281. toBase64() {
  282. var P4$ = [arguments];
  283. P4$[4] = "";
  284. P4$[9] = new Uint8Array(this.buffer);
  285. P4$[8] = this.index;
  286. for (P4$[7] = 0; P4$[7] < P4$[8]; P4$[7]++) {
  287. P4$[4] += String.fromCharCode(P4$[9][P4$[7]]);
  288. }
  289. return Gwindow.btoa(P4$[4]);
  290. }
  291. fromBase64(W69, A8Q) {
  292. var o0n = [arguments];
  293. o0n[8] = Gwindow.pako;
  294. o0n[6] = Gwindow.atob(o0n[0][0]);
  295. o0n[9] = o0n[6].length;
  296. o0n[4] = new Uint8Array(o0n[9]);
  297. for (o0n[1] = 0; o0n[1] < o0n[9]; o0n[1]++) {
  298. o0n[4][o0n[1]] = o0n[6].charCodeAt(o0n[1]);
  299. }
  300. if (o0n[0][1] === true) {
  301. o0n[5] = o0n[8].inflate(o0n[4]);
  302. o0n[4] = o0n[5];
  303. }
  304. this.buffer = o0n[4].buffer.slice(
  305. o0n[4].byteOffset,
  306. o0n[4].byteLength + o0n[4].byteOffset
  307. );
  308. this.view = new DataView(this.buffer);
  309. this.index = 0;
  310. }
  311. };
  312.  
  313. if(typeof(scope.originalSend)=='undefined'){scope.originalSend = Gwindow.WebSocket.prototype.send;}
  314. if(typeof(scope.originalXMLOpen)=='undefined'){scope.originalXMLOpen = Gwindow.XMLHttpRequest.prototype.open;}
  315. if(typeof(scope.originalXMLSend)=='undefined'){scope.originalXMLSend = Gwindow.XMLHttpRequest.prototype.send;}
  316. if(typeof(scope.searchrequested)=='undefined'){scope.searchrequested = false;}
  317.  
  318. if(typeof(scope.bonkwss)=='undefined'){scope.bonkwss = 0;}
  319. if(typeof(scope.chatlog)=='undefined'){scope.chatlog = ["ROOM START"];}
  320. if(typeof(scope.wsssendrecievelog)=='undefined'){scope.wsssendrecievelog = [];}
  321. if(typeof(scope.wsssendlog)=='undefined'){scope.wsssendlog = [];}
  322. if(typeof(scope.wssrecievelog)=='undefined'){scope.wssrecievelog = [];}
  323. if(typeof(scope.wsslogpaused)=='undefined'){scope.wsslogpaused = false;}
  324. if(typeof(scope.debuggeropen)=='undefined'){scope.debuggeropen = false;}
  325. if(typeof(scope.debuggercount)=='undefined'){scope.debuggercount = true;}
  326. if(typeof(scope.packetcount)=='undefined'){scope.packetcount = 0;}
  327. if(typeof(scope.requestedmaps)=='undefined'){scope.requestedmaps = [];}
  328. if(typeof(scope.maponclick)=='undefined'){scope.maponclick = 0;}
  329. if(typeof(scope.LZString)=='undefined'){scope.LZString = Gwindow.LZString;}
  330. if(typeof(scope.PSON)=='undefined'){scope.PSON = Gwindow.dcodeIO.PSON;}
  331. if(typeof(scope.bytebuffer)=='undefined'){scope.bytebuffer = Gwindow.dcodeIO.ByteBuffer;}
  332. if(typeof(scope.speech)=='undefined'){scope.speech = new SpeechSynthesisUtterance();speech.pitch = 0.75;}
  333. if(typeof(scope.sayer)=='undefined'){scope.sayer = speechSynthesis;sayer.volume = 0.5;sayer.rate = 1.25;}
  334.  
  335. if(typeof(scope.ISpsonpair)=='undefined'){scope.ISpsonpair = new Gwindow.dcodeIO.PSON.StaticPair(["physics", "shapes", "fixtures", "bodies", "bro", "joints", "ppm", "lights", "spawns", "lasers", "capZones", "type", "w", "h", "c", "a", "v", "l", "s", "sh", "fr", "re", "de", "sn", "fc", "fm", "f", "d", "n", "bg", "lv", "av", "ld", "ad", "fr", "bu", "cf", "rv", "p", "d", "bf", "ba", "bb", "aa", "ab", "axa", "dr", "em", "mmt", "mms", "ms", "ut", "lt", "New body", "Box Shape", "Circle Shape", "Polygon Shape", "EdgeChain Shape", "priority", "Light", "Laser", "Cap Zone", "BG Shape", "Background Layer", "Rotate Joint", "Slider Joint", "Rod Joint", "Gear Joint", 65535, 16777215]);}
  336. if(typeof(scope.sandboxon)=='undefined'){scope.sandboxon = false;}
  337. if(typeof(scope.sandboxid)=='undefined'){scope.sandboxid = 1;}
  338. if(typeof(scope.playerids)=='undefined'){scope.playerids = {};}
  339. if(typeof(scope.sandboxplayerids)=='undefined'){scope.sandboxplayerids = {};}
  340. if(typeof(scope.originalMapLoad)=='undefined'){scope.originalMapLoad = Gdocument.getElementById("maploadwindowmapscontainer").appendChild;}
  341. if(typeof(scope.originalLobbyChat)=='undefined'){scope.originalLobbyChat = Gdocument.getElementById("newbonklobby_chat_content").appendChild;}
  342. if(typeof(scope.originalIngameChat)=='undefined'){scope.originalIngameChat = Gdocument.getElementById("ingamechatcontent").appendChild;}
  343. 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];}
  344. if(Gdocument.getElementById("maploadtypedropdowntitlerequested") == null){
  345. scope.clearmaprequests = Gdocument.createElement("div");
  346. clearmaprequests.id = "clearmaprequests";
  347. clearmaprequests.classList.value = "brownButton brownButton_classic buttonShadow";
  348. clearmaprequests.textContent = "Clear";
  349. clearmaprequests.style["position"] = "absolute";
  350. clearmaprequests.style["display"] = "none";
  351. if(typeof(ishost)!='undefined'){
  352. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  353. clearmaprequests.style["display"] = "block";
  354. }
  355. }
  356. clearmaprequests.style["right"] = "306px";
  357. clearmaprequests.style["top"] = "57px";
  358. clearmaprequests.style["height"] = "23px";
  359. clearmaprequests.style["width"] = "47px";
  360. clearmaprequests.style["line-height"] = "23px";
  361. clearmaprequests.style["font-size"] = "14px";
  362. clearmaprequests.addEventListener("click",function(){
  363. requestedmaps = [];
  364. Gdocument.getElementById("maploadwindowstatustext").style["visibility"] = "inherit";
  365. Gdocument.getElementById("maploadwindowstatustext").textContent = "No Maps";
  366. while(Gdocument.getElementById("maploadwindowmapscontainer").children.length>0){
  367. Gdocument.getElementById("maploadwindowmapscontainer").removeChild(Gdocument.getElementById("maploadwindowmapscontainer").firstChild);
  368. }
  369. });
  370. Gdocument.getElementById("maploadwindow").insertBefore(clearmaprequests,Gdocument.getElementById("maploadwindowsearchinput"));
  371. scope.refreshmaprequests = Gdocument.createElement("div");
  372. refreshmaprequests.id = "refreshmaprequests";
  373. refreshmaprequests.classList.value = "brownButton brownButton_classic buttonShadow";
  374. refreshmaprequests.textContent = "Refresh";
  375. refreshmaprequests.style["position"] = "absolute";
  376. refreshmaprequests.style["display"] = "none";
  377. if(typeof(ishost)!='undefined'){
  378. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  379. refreshmaprequests.style["display"] = "block";
  380. }
  381. }
  382. refreshmaprequests.style["right"] = "357px";
  383. refreshmaprequests.style["top"] = "57px";
  384. refreshmaprequests.style["height"] = "23px";
  385. refreshmaprequests.style["width"] = "47px";
  386. refreshmaprequests.style["line-height"] = "23px";
  387. refreshmaprequests.style["font-size"] = "14px";
  388. refreshmaprequests.addEventListener("click",function(){
  389. Gdocument.getElementById("maploadtypedropdowntitle").textContent = dropdownrequested.textContent;
  390. Gdocument.getElementById("maploadwindowsearchinput").value = "";
  391. dropdownrequested.style["display"] = "none";
  392. clearmaprequests.style["display"] = "block";
  393. refreshmaprequests.style["display"] = "block";
  394. Gdocument.getElementById("maploadwindowhotnessslider").style["visibility"] = "hidden";
  395. Gdocument.getElementById("maploadwindowsearchoptions").style["visibility"] = "hidden";
  396. searchrequested = true;
  397. Gdocument.getElementById("maploadwindowsearchbutton").click();
  398.  
  399. Gdocument.getElementById("maploadtypedropdowntitle").textContent = "MAP REQUESTS";
  400. });
  401. Gdocument.getElementById("maploadwindow").insertBefore(refreshmaprequests,Gdocument.getElementById("maploadwindowsearchinput"));
  402.  
  403. scope.dropdownrequested = Gdocument.createElement("div");
  404. dropdownrequested.classList = "dropdown-option dropdown_classic";
  405. dropdownrequested.style["display"] = "none";
  406. dropdownrequested.id = "maploadtypedropdowntitlerequested";
  407.  
  408. if(Gdocument.getElementById("maploadtypedropdownoption10").style["display"] == "block"){
  409. dropdownrequested.style["display"] = "block";
  410. }
  411. dropdownrequested.textContent = "MAP REQUESTS";
  412. dropdownrequested.onclick = function(){
  413. Gdocument.getElementById("maploadtypedropdowntitle").textContent = dropdownrequested.textContent;
  414. Gdocument.getElementById("maploadwindowsearchinput").value = "";
  415. dropdownrequested.style["display"] = "none";
  416. clearmaprequests.style["display"] = "block";
  417. refreshmaprequests.style["display"] = "block";
  418. Gdocument.getElementById("maploadwindowhotnessslider").style["visibility"] = "hidden";
  419. Gdocument.getElementById("maploadwindowsearchoptions").style["visibility"] = "hidden";
  420. searchrequested = true;
  421. Gdocument.getElementById("maploadwindowsearchbutton").click();
  422.  
  423. Gdocument.getElementById("maploadtypedropdowntitle").textContent = "MAP REQUESTS";
  424. };
  425. (new MutationObserver(function(){if(Gdocument.getElementById("maploadtypedropdownoption10").style["display"] == "none"){ dropdownrequested.style["display"] = "none"; clearmaprequests.style["display"] = "none";refreshmaprequests.style["display"] = "none"; } else{ dropdownrequested.style["display"] = "block";}})).observe(Gdocument.getElementById("maploadtypedropdownoption10"),{attributes:true,childList:true});
  426. Gdocument.getElementById("maploadtypedropdown").insertBefore(dropdownrequested,Gdocument.getElementById("maploadtypedropdownoption1"));
  427. };
  428.  
  429. function sandboxonclick(){
  430. Gdocument.getElementById("roomlistcreatewindowmaxplayers").value = 1;
  431. Gdocument.getElementById("roomlistcreatewindowunlistedcheckbox").checked = true;
  432. Gdocument.getElementById("roomlistcreatecreatebutton").click();
  433. sandboxon = true;
  434. }
  435. function checkboxclearbuttononclick(){
  436. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  437. var e = true;
  438. for(var i = 0; i<classes.length;i++){
  439. if(classes[i].checked == true){
  440. e = false
  441. }
  442. classes[i].checked = false;
  443. }
  444. if(e){
  445. for(var i = 0; i<classes.length;i++){
  446. classes[i].checked = true;
  447. }
  448. }
  449. }
  450. if(Gdocument.getElementById("classic_mid_sandbox")==null){
  451. Gdocument.getElementById("roomlistrefreshbutton").click();
  452. scope.sandboxbutton = Gdocument.createElement("div");
  453. sandboxbutton.id = "classic_mid_sandbox";
  454. sandboxbutton.classList.value = "brownButton brownButton_classic classic_mid_buttons";
  455. sandboxbutton.textContent = "Sandbox";
  456. sandboxbutton.addEventListener("click",sandboxonclick);
  457. Gdocument.getElementById("classic_mid").insertBefore(sandboxbutton,Gdocument.getElementById("classic_mid_news"));
  458.  
  459. }
  460. if(Gdocument.getElementById("clearallcheckboxes")==null){
  461. scope.checkboxclearbutton = Gdocument.createElement("div");
  462. checkboxclearbutton.id = "clearallcheckboxes";
  463. checkboxclearbutton.classList.value = "brownButton brownButton_classic buttonShadow";
  464. checkboxclearbutton.textContent = "On/Off";
  465. checkboxclearbutton.style["position"] = "absolute";
  466. checkboxclearbutton.style["display"] = "none";
  467. if(typeof(ishost)!='undefined'){
  468. if(ishost && stopquickplay == 0){
  469. checkboxclearbutton.style["display"] = "block";
  470. }
  471. }
  472. checkboxclearbutton.style["right"] = "255px";
  473. checkboxclearbutton.style["top"] = "57px";
  474. checkboxclearbutton.style["height"] = "23px";
  475. checkboxclearbutton.style["width"] = "47px";
  476. checkboxclearbutton.style["line-height"] = "23px";
  477. checkboxclearbutton.style["font-size"] = "13px";
  478. checkboxclearbutton.addEventListener("click",checkboxclearbuttononclick);
  479. Gdocument.getElementById("maploadwindow").insertBefore(checkboxclearbutton,Gdocument.getElementById("maploadwindowsearchinput"));
  480.  
  481. }
  482. scope.holdloadbuttonTimeout = [];
  483. scope.holdloadbutton = function(){
  484. var scrollcount = 0;
  485. var mapwindow = Gdocument.getElementById("maploadwindowmapscontainer");
  486. mapwindow.scroll(0,mapwindow.scrollHeight);
  487. };
  488.  
  489. if(Gdocument.getElementById("mapwindowloadall")==null){
  490. scope.loadall = Gdocument.createElement("div");
  491. loadall.id = "mapwindowloadall";
  492. loadall.classList.value = "brownButton brownButton_classic buttonShadow";
  493. loadall.textContent = "Load";
  494. loadall.style["position"] = "absolute";
  495. loadall.style["display"] = "block";
  496. loadall.style["left"] = "204px";
  497. loadall.style["top"] = "57px";
  498. loadall.style["height"] = "23px";
  499. loadall.style["width"] = "34px";
  500. loadall.style["line-height"] = "23px";
  501. loadall.style["font-size"] = "12px";
  502. var repeat = function(){holdloadbutton();holdloadbuttonTimeout.push(setTimeout(repeat,25));};
  503. loadall.onmousedown = function(){repeat();};
  504. loadall.onmouseup = function(){for(var i = 0; i<holdloadbuttonTimeout.length; i++){clearTimeout(holdloadbuttonTimeout[i]);}};
  505. loadall.onmouseout = function(){for(var i = 0; i<holdloadbuttonTimeout.length; i++){clearTimeout(holdloadbuttonTimeout[i]);}};
  506.  
  507. Gdocument.getElementById("maploadwindow").insertBefore(loadall,Gdocument.getElementById("maploadwindowsearchinput"));
  508.  
  509. }
  510. if(Gdocument.getElementById("BonkCommandsDebuggerContainer")==null){
  511. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=3;
  512. scope.debuggermenu = Gdocument.createElement("div");
  513. debuggermenu.id = "BonkCommandsDebuggerContainer";
  514. debuggermenu.style["position"] = "absolute";
  515. debuggermenu.style["display"] = "none";
  516. if(typeof(debuggeropen)!='undefined'){
  517. if(debuggeropen){
  518. debuggermenu.style["display"] = "block";
  519. }
  520. }
  521. debuggermenu.style["width"] = Gdocument.getElementById("bonkiocontainer").style["width"];
  522. debuggermenu.style["height"] = Gdocument.getElementById("bonkiocontainer").style["height"];
  523.  
  524. debuggermenu.style["background"] = "rgb(26, 39, 51)";
  525.  
  526. scope.width = parseInt(Gdocument.getElementById("bonkiocontainer").style["width"])-20;
  527. scope.height = parseInt(Gdocument.getElementById("bonkiocontainer").style["height"])-210;
  528.  
  529. scope.logmenu = Gdocument.createElement("div");
  530. logmenu.id = "BonkCommandsWebSocketLog";
  531. logmenu.style["position"] = "absolute";
  532. logmenu.style["width"] = width.toString()+"px";
  533. logmenu.style["height"] = height.toString()+"px";
  534. logmenu.style["top"] = "80px";
  535. logmenu.style["left"] = "10px";
  536. logmenu.style["background"] = "rgb(207, 216, 220)";
  537. scope.logmenutopleft = Gdocument.createElement("div");
  538. logmenutopleft.id = "BonkCommandsWebSocketLog";
  539. logmenutopleft.style["position"] = "absolute";
  540. logmenutopleft.textContent = "Sending";
  541. logmenutopleft.classList = "newbonklobby_boxtop newbonklobby_boxtop_classic";
  542. logmenutopleft.style["width"] = (width/2).toString()+"px";
  543. logmenutopleft.style["height"] = "30px";
  544. logmenutopleft.style["top"] = "-30px";
  545. logmenutopleft.style["background"] = "rgb(0, 150, 136)";
  546. logmenu.appendChild(logmenutopleft);
  547. scope.logmenutopright = Gdocument.createElement("div");
  548. logmenutopright.id = "BonkCommandsWebSocketLog";
  549. logmenutopright.style["position"] = "absolute";
  550. logmenutopright.textContent = "Recieving";
  551. logmenutopright.classList = "newbonklobby_boxtop newbonklobby_boxtop_classic";
  552. logmenutopright.style["width"] = (width/2).toString()+"px";
  553. logmenutopright.style["height"] = "30px";
  554. logmenutopright.style["left"] = (width/2).toString()+"px";
  555. logmenutopright.style["top"] = "-30px";
  556. logmenutopright.style["background"] = "rgb(0, 150, 136)";
  557. logmenu.appendChild(logmenutopright);
  558. scope.logmenutable = Gdocument.createElement("table");
  559. logmenutable.id = "BonkCommandsWebSocketTable";
  560. logmenutable.style["position"] = "absolute";
  561. logmenutable.style["border-spacing"] = "0px";
  562. logmenutable.style["font-size"] = "12px";
  563. logmenutable.style["display"] = "table-cell";
  564. logmenutable.style["width"] = "50%";
  565. logmenutable.style["height"] = "100%";
  566. logmenutable.style["table-layout"] = "fixed";
  567. logmenutable.style["overflow-y"] = "scroll";
  568.  
  569. scope.logmenutable2 = Gdocument.createElement("table");
  570. logmenutable2.id = "BonkCommandsWebSocketTable2";
  571. logmenutable2.style["position"] = "absolute";
  572. logmenutable2.style["width"] = "50%";
  573. logmenutable2.style["left"] = "50%";
  574. logmenutable2.style["font-size"] = "12px";
  575. logmenutable2.style["display"] = "table-cell";
  576. logmenutable2.style["height"] = "100%";
  577. logmenutable2.style["table-layout"] = "fixed";
  578. logmenutable2.style["overflow-y"] = "scroll";
  579. logmenutable2.style["border-spacing"] = "0px";
  580. scope.leftsync = false;
  581. scope.rightsync = false;
  582. logmenutable2.onscroll = function(){
  583. if(!leftsync){
  584. rightsync = true;
  585. logmenutable.scrollTop = this.scrollTop;
  586. }
  587. else{
  588. leftsync = false;
  589. }
  590. };
  591. logmenutable.onscroll = function(){
  592. if(!rightsync){
  593. leftsync = true;
  594. logmenutable2.scrollTop = this.scrollTop;
  595. }
  596. else{
  597. rightsync = false
  598. }
  599. };
  600. logmenu.appendChild(logmenutable);
  601. logmenu.appendChild(logmenutable2);
  602. debuggermenu.appendChild(logmenu);
  603. scope.debuggermenuclose = Gdocument.createElement("div");
  604. debuggermenuclose.id = "debuggerclose";
  605. debuggermenuclose.classList = "windowCloseButton brownButton brownButton_classic buttonShadow";
  606. debuggermenuclose.style["position"] = "absolute";
  607. debuggermenuclose.style["top"] = "40px";
  608. debuggermenuclose.style["right"] = "5px";
  609. debuggermenuclose.onclick = function(){debuggeropen = false;debuggermenu.style["display"] = "none";Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  610. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";};
  611. debuggermenu.appendChild(debuggermenuclose);
  612. scope.debuggerform = Gdocument.createElement("form");
  613. debuggerform.autocomplete = "off";
  614. scope.debuggerinput = Gdocument.createElement("input");
  615. debuggerinput.style["position"] = "absolute";
  616. debuggerinput.style["width"] = width.toString()+"px";
  617. debuggerinput.style["left"] = "10px";
  618. debuggerinput.style["top"] = (height+90).toString()+"px";
  619. debuggerinput.style["font-size"] = "12px";
  620. debuggerinput.style["height"] = "20px";
  621. debuggerform.appendChild(debuggerinput);
  622. scope.debuggersendrecieve = Gdocument.createElement("div");
  623. debuggersendrecieve.style["position"] = "absolute";
  624. debuggersendrecieve.style["width"] = "140px";
  625. debuggersendrecieve.style["left"] = "10px";
  626. debuggersendrecieve.style["top"] = (height+120).toString()+"px";
  627. debuggersendrecieve.style["font-size"] = "15px";
  628. debuggersendrecieve.style["height"] = "20px";
  629. debuggersendrecieve.classList = "brownButton brownButton_classic buttonShadow";
  630. debuggersendrecieve.textContent = "Send";
  631. debuggersendrecieve.value = 0;
  632. debuggersendrecieve.onclick = function(){if(this.value == 0){this.textContent = "Recieve";this.value = 1;}else{this.textContent = "Send";this.value = 0;}};
  633.  
  634. debuggermenu.appendChild(debuggersendrecieve);
  635. scope.debuggerpausebutton = Gdocument.createElement("div");
  636. debuggerpausebutton.style["position"] = "absolute";
  637. debuggerpausebutton.style["width"] = "140px";
  638. debuggerpausebutton.style["left"] = "10px";
  639. debuggerpausebutton.style["top"] = (height+150).toString()+"px";
  640. debuggerpausebutton.style["font-size"] = "15px";
  641. debuggerpausebutton.style["height"] = "20px";
  642. debuggerpausebutton.classList = "brownButton brownButton_classic buttonShadow";
  643. debuggerpausebutton.textContent = "Pause";
  644. debuggerpausebutton.value = 0;
  645. debuggerpausebutton.onclick = function(){if(this.value == 0){this.textContent = "Play";this.value = 1;wsslogpaused = true}else{this.textContent = "Pause";this.value = 0;wsslogpaused = false;}};
  646.  
  647. debuggermenu.appendChild(debuggerpausebutton);
  648. scope.debuggereval = Gdocument.createElement("input");
  649. debuggereval.style["position"] = "absolute";
  650. debuggereval.style["width"] = (width-150).toString()+"px";
  651. debuggereval.style["right"] = "10px";
  652. debuggereval.style["top"] = (height+120).toString()+"px";
  653. debuggereval.style["font-size"] = "12px";
  654. debuggereval.style["height"] = "20px";
  655. debuggereval.addEventListener("keypress",function(e){if(e.repeat){return;}if(e.code == "Enter"){if(debuggersendrecieve.value == 0){SEND(this.value);}else{RECIEVE(this.value);}}});
  656. debuggerform.appendChild(debuggereval);
  657. debuggermenu.appendChild(debuggerform);
  658. Gdocument.getElementById("newbonkgamecontainer").appendChild(debuggermenu);
  659.  
  660. }
  661. scope.ISdecode = function(rawdata) {
  662. rawdata_caseflipped = "";
  663. for (i = 0; i < rawdata.length; i++) {
  664. if (i <= 100 && rawdata.charAt(i) === rawdata.charAt(i).toLowerCase()) {
  665. rawdata_caseflipped += rawdata.charAt(i).toUpperCase();
  666. } else if (i <= 100 && rawdata.charAt(i) === rawdata.charAt(i).toUpperCase()) {
  667. rawdata_caseflipped += rawdata.charAt(i).toLowerCase();
  668. } else {
  669. rawdata_caseflipped += rawdata.charAt(i);
  670. }
  671. }
  672.  
  673. data_deLZd = LZString.decompressFromEncodedURIComponent(rawdata_caseflipped);
  674. databuffer = bytebuffer.fromBase64(data_deLZd);
  675. data = ISpsonpair.decode(databuffer.buffer);
  676. return data;
  677. };
  678. scope.ISencode = function(obj) {
  679. data = ISpsonpair.encode(obj);
  680. b64 = data.toBase64();
  681. lzd = LZString.compressToEncodedURIComponent(b64);
  682.  
  683. caseflipped = "";
  684. for (i = 0; i < lzd.length; i++) {
  685. if (i <= 100 && lzd.charAt(i) === lzd.charAt(i).toLowerCase()) {
  686. caseflipped += lzd.charAt(i).toUpperCase();
  687. } else if (i <= 100 && lzd.charAt(i) === lzd.charAt(i).toUpperCase()) {
  688. caseflipped += lzd.charAt(i).toLowerCase();
  689. } else {
  690. caseflipped += lzd.charAt(i);
  691. }
  692. }
  693.  
  694.  
  695. return caseflipped;
  696. };
  697. scope.decodeIS = function(x){
  698. return ISdecode(x);
  699. };
  700. scope.encodeIS = function(x){
  701. return ISencode(x);
  702. };
  703.  
  704.  
  705. encodeToDatabase = function(mapObject) {
  706. var H_B = [arguments];
  707. H_B[2] = new bytebuffer2;
  708. H_B[5] = mapObject.physics;
  709. mapObject.v = 13;
  710. H_B[2].writeShort(mapObject.v);
  711. H_B[2].writeBoolean(mapObject.s.re);
  712. H_B[2].writeBoolean(mapObject.s.nc);
  713. H_B[2].writeShort(mapObject.s.pq);
  714. H_B[2].writeFloat(mapObject.s.gd);
  715. H_B[2].writeBoolean(mapObject.s.fl);
  716. H_B[2].writeUTF(mapObject.m.rxn);
  717. H_B[2].writeUTF(mapObject.m.rxa);
  718. H_B[2].writeUint(mapObject.m.rxid);
  719. H_B[2].writeShort(mapObject.m.rxdb);
  720. H_B[2].writeUTF(mapObject.m.n);
  721. H_B[2].writeUTF(mapObject.m.a);
  722. H_B[2].writeUint(mapObject.m.vu);
  723. H_B[2].writeUint(mapObject.m.vd);
  724. H_B[2].writeShort(mapObject.m.cr.length);
  725. for (
  726. H_B[62] = 0;
  727. H_B[62] < mapObject.m.cr.length;
  728. H_B[62]++
  729. ) {
  730. H_B[2].writeUTF(mapObject.m.cr[H_B[62]]);
  731. }
  732. H_B[2].writeUTF(mapObject.m.mo);
  733. H_B[2].writeInt(mapObject.m.dbid);
  734. H_B[2].writeBoolean(mapObject.m.pub);
  735. H_B[2].writeInt(mapObject.m.dbv);
  736. H_B[2].writeShort(H_B[5].ppm);
  737. H_B[2].writeShort(H_B[5].bro.length);
  738. for (H_B[31] = 0; H_B[31] < H_B[5].bro.length; H_B[31]++) {
  739. H_B[2].writeShort(H_B[5].bro[H_B[31]]);
  740. }
  741. H_B[2].writeShort(H_B[5].shapes.length);
  742. for (H_B[61] = 0; H_B[61] < H_B[5].shapes.length; H_B[61]++) {
  743. H_B[3] = H_B[5].shapes[H_B[61]];
  744. if (H_B[3].type == "bx") {
  745. H_B[2].writeShort(1);
  746. H_B[2].writeDouble(H_B[3].w);
  747. H_B[2].writeDouble(H_B[3].h);
  748. H_B[2].writeDouble(H_B[3].c[0]);
  749. H_B[2].writeDouble(H_B[3].c[1]);
  750. H_B[2].writeDouble(H_B[3].a);
  751. H_B[2].writeBoolean(H_B[3].sk);
  752. }
  753. if (H_B[3].type == "ci") {
  754. H_B[2].writeShort(2);
  755. H_B[2].writeDouble(H_B[3].r);
  756. H_B[2].writeDouble(H_B[3].c[0]);
  757. H_B[2].writeDouble(H_B[3].c[1]);
  758. H_B[2].writeBoolean(H_B[3].sk);
  759. }
  760. if (H_B[3].type == "po") {
  761. H_B[2].writeShort(3);
  762. H_B[2].writeDouble(H_B[3].s);
  763. H_B[2].writeDouble(H_B[3].a);
  764. H_B[2].writeDouble(H_B[3].c[0]);
  765. H_B[2].writeDouble(H_B[3].c[1]);
  766. H_B[2].writeShort(H_B[3].v.length);
  767. for (H_B[45] = 0; H_B[45] < H_B[3].v.length; H_B[45]++) {
  768. H_B[2].writeDouble(H_B[3].v[H_B[45]][0]);
  769. H_B[2].writeDouble(H_B[3].v[H_B[45]][1]);
  770. }
  771. }
  772. }
  773. H_B[2].writeShort(H_B[5].fixtures.length);
  774. for (H_B[88] = 0; H_B[88] < H_B[5].fixtures.length; H_B[88]++) {
  775. H_B[4] = H_B[5].fixtures[H_B[88]];
  776. H_B[2].writeShort(H_B[4].sh);
  777. H_B[2].writeUTF(H_B[4].n);
  778. if (H_B[4].fr === null) {
  779. H_B[2].writeDouble(Number.MAX_VALUE);
  780. } else {
  781. H_B[2].writeDouble(H_B[4].fr);
  782. }
  783. if (H_B[4].fp === null) {
  784. H_B[2].writeShort(0);
  785. }
  786. if (H_B[4].fp === false) {
  787. H_B[2].writeShort(1);
  788. }
  789. if (H_B[4].fp === true) {
  790. H_B[2].writeShort(2);
  791. }
  792. if (H_B[4].re === null) {
  793. H_B[2].writeDouble(Number.MAX_VALUE);
  794. } else {
  795. H_B[2].writeDouble(H_B[4].re);
  796. }
  797. if (H_B[4].de === null) {
  798. H_B[2].writeDouble(Number.MAX_VALUE);
  799. } else {
  800. H_B[2].writeDouble(H_B[4].de);
  801. }
  802. H_B[2].writeUint(H_B[4].f);
  803. H_B[2].writeBoolean(H_B[4].d);
  804. H_B[2].writeBoolean(H_B[4].np);
  805. H_B[2].writeBoolean(H_B[4].ng);
  806. H_B[2].writeBoolean(H_B[4].ig);
  807. }
  808. H_B[2].writeShort(H_B[5].bodies.length);
  809. for (H_B[41] = 0; H_B[41] < H_B[5].bodies.length; H_B[41]++) {
  810. H_B[9] = H_B[5].bodies[H_B[41]];
  811. H_B[2].writeUTF(H_B[9].type);
  812. H_B[2].writeUTF(H_B[9].n);
  813. H_B[2].writeDouble(H_B[9].p[0]);
  814. H_B[2].writeDouble(H_B[9].p[1]);
  815. H_B[2].writeDouble(H_B[9].a);
  816. H_B[2].writeDouble(H_B[9].fric);
  817. H_B[2].writeBoolean(H_B[9].fricp);
  818. H_B[2].writeDouble(H_B[9].re);
  819. H_B[2].writeDouble(H_B[9].de);
  820. H_B[2].writeDouble(H_B[9].lv[0]);
  821. H_B[2].writeDouble(H_B[9].lv[1]);
  822. H_B[2].writeDouble(H_B[9].av);
  823. H_B[2].writeDouble(H_B[9].ld);
  824. H_B[2].writeDouble(H_B[9].ad);
  825. H_B[2].writeBoolean(H_B[9].fr);
  826. H_B[2].writeBoolean(H_B[9].bu);
  827. H_B[2].writeDouble(H_B[9].cf.x);
  828. H_B[2].writeDouble(H_B[9].cf.y);
  829. H_B[2].writeDouble(H_B[9].cf.ct);
  830. H_B[2].writeBoolean(H_B[9].cf.w);
  831. H_B[2].writeShort(H_B[9].f_c);
  832. H_B[2].writeBoolean(H_B[9].f_1);
  833. H_B[2].writeBoolean(H_B[9].f_2);
  834. H_B[2].writeBoolean(H_B[9].f_3);
  835. H_B[2].writeBoolean(H_B[9].f_4);
  836. H_B[2].writeBoolean(H_B[9].f_p);
  837. H_B[2].writeShort(H_B[9].fx.length);
  838. for (H_B[78] = 0; H_B[78] < H_B[9].fx.length; H_B[78]++) {
  839. H_B[2].writeShort(H_B[9].fx[H_B[78]]);
  840. }
  841. }
  842. H_B[2].writeShort(mapObject.spawns.length);
  843. for (
  844. H_B[74] = 0;
  845. H_B[74] < mapObject.spawns.length;
  846. H_B[74]++
  847. ) {
  848. H_B[6] = mapObject.spawns[H_B[74]];
  849. H_B[2].writeDouble(H_B[6].x);
  850. H_B[2].writeDouble(H_B[6].y);
  851. H_B[2].writeDouble(H_B[6].xv);
  852. H_B[2].writeDouble(H_B[6].yv);
  853. H_B[2].writeShort(H_B[6].priority);
  854. H_B[2].writeBoolean(H_B[6].r);
  855. H_B[2].writeBoolean(H_B[6].f);
  856. H_B[2].writeBoolean(H_B[6].b);
  857. H_B[2].writeBoolean(H_B[6].gr);
  858. H_B[2].writeBoolean(H_B[6].ye);
  859. H_B[2].writeUTF(H_B[6].n);
  860. }
  861. H_B[2].writeShort(mapObject.capZones.length);
  862. for (
  863. H_B[48] = 0;
  864. H_B[48] < mapObject.capZones.length;
  865. H_B[48]++
  866. ) {
  867. H_B[1] = mapObject.capZones[H_B[48]];
  868. H_B[2].writeUTF(H_B[1].n);
  869. H_B[2].writeDouble(H_B[1].l);
  870. H_B[2].writeShort(H_B[1].i);
  871. H_B[2].writeShort(H_B[1].ty);
  872. }
  873. H_B[2].writeShort(H_B[5].joints.length);
  874. for (H_B[69] = 0; H_B[69] < H_B[5].joints.length; H_B[69]++) {
  875. H_B[8] = H_B[5].joints[H_B[69]];
  876. if (H_B[8].type == "rv") {
  877. H_B[2].writeShort(1);
  878. H_B[2].writeDouble(H_B[8].d.la);
  879. H_B[2].writeDouble(H_B[8].d.ua);
  880. H_B[2].writeDouble(H_B[8].d.mmt);
  881. H_B[2].writeDouble(H_B[8].d.ms);
  882. H_B[2].writeBoolean(H_B[8].d.el);
  883. H_B[2].writeBoolean(H_B[8].d.em);
  884. H_B[2].writeDouble(H_B[8].aa[0]);
  885. H_B[2].writeDouble(H_B[8].aa[1]);
  886. }
  887. if (H_B[8].type == "d") {
  888. H_B[2].writeShort(2);
  889. H_B[2].writeDouble(H_B[8].d.fh);
  890. H_B[2].writeDouble(H_B[8].d.dr);
  891. H_B[2].writeDouble(H_B[8].aa[0]);
  892. H_B[2].writeDouble(H_B[8].aa[1]);
  893. H_B[2].writeDouble(H_B[8].ab[0]);
  894. H_B[2].writeDouble(H_B[8].ab[1]);
  895. }
  896. if (H_B[8].type == "lpj") {
  897. H_B[2].writeShort(3);
  898. H_B[2].writeDouble(H_B[8].pax);
  899. H_B[2].writeDouble(H_B[8].pay);
  900. H_B[2].writeDouble(H_B[8].pa);
  901. H_B[2].writeDouble(H_B[8].pf);
  902. H_B[2].writeDouble(H_B[8].pl);
  903. H_B[2].writeDouble(H_B[8].pu);
  904. H_B[2].writeDouble(H_B[8].plen);
  905. H_B[2].writeDouble(H_B[8].pms);
  906. }
  907. if (H_B[8].type == "lsj") {
  908. H_B[2].writeShort(4);
  909. H_B[2].writeDouble(H_B[8].sax);
  910. H_B[2].writeDouble(H_B[8].say);
  911. H_B[2].writeDouble(H_B[8].sf);
  912. H_B[2].writeDouble(H_B[8].slen);
  913. }
  914. H_B[2].writeShort(H_B[8].ba);
  915. H_B[2].writeShort(H_B[8].bb);
  916. H_B[2].writeBoolean(H_B[8].d.cc);
  917. H_B[2].writeDouble(H_B[8].d.bf);
  918. H_B[2].writeBoolean(H_B[8].d.dl);
  919. }
  920. H_B[15] = H_B[2].toBase64();
  921. H_B[30] = LZString.compressToEncodedURIComponent(H_B[15]);
  922. return H_B[30];
  923. };
  924.  
  925.  
  926.  
  927.  
  928.  
  929. scope.decodeFromDatabase = function(map) {
  930. var a8k = [arguments];
  931. b64mapdata = LZString.decompressFromEncodedURIComponent(map);
  932. var binaryReader = new bytebuffer2;
  933. binaryReader.fromBase64(b64mapdata, false);
  934. map = { "v": 1, "s": { "re": false, "nc": false, "pq": 1, "gd": 25, "fl": false }, "physics": { "shapes": [], "fixtures": [], "bodies": [], "bro": [], "joints": [], "ppm": 12 }, "spawns": [], "capZones": [], "m": { "a": "noauthor", "n": "noname", "dbv": 2, "dbid": -1, "authid": -1, "date": "", "rxid": 0, "rxn": "", "rxa": "", "rxdb": 1, "cr": [], "pub": false, "mo": "" } };
  935. map.v = binaryReader.readShort();
  936. if (map.v > 13) {
  937. throw new Error("New map format, this script needs to be updated.");
  938. }
  939. map.s.re = binaryReader.readBoolean();
  940. map.s.nc = binaryReader.readBoolean();
  941. if (map.v >= 3) {
  942. map.s.pq = binaryReader.readShort();
  943. }
  944. if (map.v >= 4 && map.v <= 12) {
  945. map.s.gd = binaryReader.readShort();
  946. } else if (map.v >= 13) {
  947. map.s.gd = binaryReader.readFloat();
  948. }
  949. if (map.v >= 9) {
  950. map.s.fl = binaryReader.readBoolean();
  951. }
  952. map.m.rxn = binaryReader.readUTF();
  953. map.m.rxa = binaryReader.readUTF();
  954. map.m.rxid = binaryReader.readUint();
  955. map.m.rxdb = binaryReader.readShort();
  956. map.m.n = binaryReader.readUTF();
  957. map.m.a = binaryReader.readUTF();
  958. if (map.v >= 10) {
  959. map.m.vu = binaryReader.readUint();
  960. map.m.vd = binaryReader.readUint();
  961. }
  962. if (map.v >= 4) {
  963. cr_count = binaryReader.readShort();
  964. for (cr_iterator = 0; cr_iterator < cr_count; cr_iterator++) {
  965. map.m.cr.push(binaryReader.readUTF());
  966. }
  967. }
  968. if (map.v >= 5) {
  969. map.m.mo = binaryReader.readUTF();
  970. map.m.dbid = binaryReader.readInt();
  971. }
  972. if (map.v >= 7) {
  973. map.m.pub = binaryReader.readBoolean();
  974. }
  975. if (map.v >= 8) {
  976. map.m.dbv = binaryReader.readInt();
  977. }
  978. map.physics.ppm = binaryReader.readShort();
  979. bro_count = binaryReader.readShort();
  980. for (bro_iterator = 0; bro_iterator < bro_count; bro_iterator++) {
  981. map.physics.bro[bro_iterator] = binaryReader.readShort();
  982. }
  983. shape_count = binaryReader.readShort();
  984. for (shape_iterator = 0; shape_iterator < shape_count; shape_iterator++) {
  985. shape_type = binaryReader.readShort();
  986. if (shape_type == 1) {
  987. map.physics.shapes[shape_iterator] = {"type":"bx","w":10,"h":40,"c":[0,0],"a":0,"sk":false};
  988. map.physics.shapes[shape_iterator].w = binaryReader.readDouble();
  989. map.physics.shapes[shape_iterator].h = binaryReader.readDouble();
  990. map.physics.shapes[shape_iterator].c = [binaryReader.readDouble(), binaryReader.readDouble()];
  991. map.physics.shapes[shape_iterator].a = binaryReader.readDouble();
  992. map.physics.shapes[shape_iterator].sk = binaryReader.readBoolean();
  993. }
  994. if (shape_type == 2) {
  995. map.physics.shapes[shape_iterator] = {"type":"ci","r":25,"c":[0,0],"sk":false};
  996. map.physics.shapes[shape_iterator].r = binaryReader.readDouble();
  997. map.physics.shapes[shape_iterator].c = [binaryReader.readDouble(), binaryReader.readDouble()];
  998. map.physics.shapes[shape_iterator].sk = binaryReader.readBoolean();
  999. }
  1000. if (shape_type == 3) {
  1001. map.physics.shapes[shape_iterator] = {"type":"po","v":[],"s":1,"a":0,"c":[0,0]};
  1002. map.physics.shapes[shape_iterator].s = binaryReader.readDouble();
  1003. map.physics.shapes[shape_iterator].a = binaryReader.readDouble();
  1004. map.physics.shapes[shape_iterator].c = [binaryReader.readDouble(), binaryReader.readDouble()];
  1005. point_count = binaryReader.readShort();
  1006. map.physics.shapes[shape_iterator].v = [];
  1007. for (point_iterator = 0; point_iterator < point_count; point_iterator++) {
  1008. map.physics.shapes[shape_iterator].v.push([binaryReader.readDouble(), binaryReader.readDouble()]);
  1009. }
  1010. }
  1011. }
  1012. a8k[31] = binaryReader.readShort();
  1013. for (a8k[89] = 0; a8k[89] < a8k[31]; a8k[89]++) {
  1014. map.physics.fixtures[a8k[89]] = {"n":"Def Fix","fr":0.3,"fp":null,"re":0.8,"de":0.3,"f":5209260,"d":false,"np":false,"ng":false};
  1015. map.physics.fixtures[a8k[89]].sh = binaryReader.readShort();
  1016. map.physics.fixtures[a8k[89]].n = binaryReader.readUTF();
  1017. map.physics.fixtures[a8k[89]].fr = binaryReader.readDouble();
  1018. if (map.physics.fixtures[a8k[89]].fr == Number.MAX_VALUE) {
  1019. map.physics.fixtures[a8k[89]].fr = null;
  1020. }
  1021. a8k[22] = binaryReader.readShort();
  1022. if (a8k[22] == 0) {
  1023. map.physics.fixtures[a8k[89]].fp = null;
  1024. }
  1025. if (a8k[22] == 1) {
  1026. map.physics.fixtures[a8k[89]].fp = false;
  1027. }
  1028. if (a8k[22] == 2) {
  1029. map.physics.fixtures[a8k[89]].fp = true;
  1030. }
  1031. map.physics.fixtures[a8k[89]].re = binaryReader.readDouble();
  1032. if (map.physics.fixtures[a8k[89]].re == Number.MAX_VALUE) {
  1033. map.physics.fixtures[a8k[89]].re = null;
  1034. }
  1035. map.physics.fixtures[a8k[89]].de = binaryReader.readDouble();
  1036. if (map.physics.fixtures[a8k[89]].de == Number.MAX_VALUE) {
  1037. map.physics.fixtures[a8k[89]].de = null;
  1038. }
  1039. map.physics.fixtures[a8k[89]].f = binaryReader.readUint();
  1040. map.physics.fixtures[a8k[89]].d = binaryReader.readBoolean();
  1041. map.physics.fixtures[a8k[89]].np = binaryReader.readBoolean();
  1042. if (map.v >= 11) {
  1043. map.physics.fixtures[a8k[89]].ng = binaryReader.readBoolean();
  1044. }
  1045. if (map.v >= 12) {
  1046. map.physics.fixtures[a8k[89]].ig = binaryReader.readBoolean();
  1047. }
  1048. }
  1049. a8k[41] = binaryReader.readShort();
  1050. for (a8k[20] = 0; a8k[20] < a8k[41]; a8k[20]++) {
  1051. map.physics.bodies[a8k[20]] = {"type":"s","n":"Unnamed","p":[0,0],"a":0,"fric":0.3,"fricp":false,"re":0.8,"de":0.3,"lv":[0,0],"av":0,"ld":0,"ad":0,"fr":false,"bu":false,"cf":{"x":0,"y":0,"w":true,"ct":0},"fx":[],"f_c":1,"f_p":true,"f_1":true,"f_2":true,"f_3":true,"f_4":true};
  1052. map.physics.bodies[a8k[20]].type = binaryReader.readUTF();
  1053. map.physics.bodies[a8k[20]].n = binaryReader.readUTF();
  1054. map.physics.bodies[a8k[20]].p = [binaryReader.readDouble(), binaryReader.readDouble()];
  1055. map.physics.bodies[a8k[20]].a = binaryReader.readDouble();
  1056. map.physics.bodies[a8k[20]].fric = binaryReader.readDouble();
  1057. map.physics.bodies[a8k[20]].fricp = binaryReader.readBoolean();
  1058. map.physics.bodies[a8k[20]].re = binaryReader.readDouble();
  1059. map.physics.bodies[a8k[20]].de = binaryReader.readDouble();
  1060. map.physics.bodies[a8k[20]].lv = [binaryReader.readDouble(), binaryReader.readDouble()];
  1061. map.physics.bodies[a8k[20]].av = binaryReader.readDouble();
  1062. map.physics.bodies[a8k[20]].ld = binaryReader.readDouble();
  1063. map.physics.bodies[a8k[20]].ad = binaryReader.readDouble();
  1064. map.physics.bodies[a8k[20]].fr = binaryReader.readBoolean();
  1065. map.physics.bodies[a8k[20]].bu = binaryReader.readBoolean();
  1066. map.physics.bodies[a8k[20]].cf.x = binaryReader.readDouble();
  1067. map.physics.bodies[a8k[20]].cf.y = binaryReader.readDouble();
  1068. map.physics.bodies[a8k[20]].cf.ct = binaryReader.readDouble();
  1069. map.physics.bodies[a8k[20]].cf.w = binaryReader.readBoolean();
  1070. map.physics.bodies[a8k[20]].f_c = binaryReader.readShort();
  1071. map.physics.bodies[a8k[20]].f_1 = binaryReader.readBoolean();
  1072. map.physics.bodies[a8k[20]].f_2 = binaryReader.readBoolean();
  1073. map.physics.bodies[a8k[20]].f_3 = binaryReader.readBoolean();
  1074. map.physics.bodies[a8k[20]].f_4 = binaryReader.readBoolean();
  1075. if (map.v >= 2) {
  1076. map.physics.bodies[a8k[20]].f_p = binaryReader.readBoolean();
  1077. }
  1078. a8k[50] = binaryReader.readShort();
  1079. for (a8k[66] = 0; a8k[66] < a8k[50]; a8k[66]++) {
  1080. map.physics.bodies[a8k[20]].fx.push(binaryReader.readShort());
  1081. }
  1082. }
  1083. a8k[48] = binaryReader.readShort();
  1084. for (a8k[36] = 0; a8k[36] < a8k[48]; a8k[36]++) {
  1085. map.spawns[a8k[36]] = {"x":400,"y":300,"xv":0,"yv":0,"priority":5,"r":true,"f":true,"b":true,"gr":false,"ye":false,"n":"Spawn"};
  1086. a8k[80] = map.spawns[a8k[36]];
  1087. a8k[80].x = binaryReader.readDouble();
  1088. a8k[80].y = binaryReader.readDouble();
  1089. a8k[80].xv = binaryReader.readDouble();
  1090. a8k[80].yv = binaryReader.readDouble();
  1091. a8k[80].priority = binaryReader.readShort();
  1092. a8k[80].r = binaryReader.readBoolean();
  1093. a8k[80].f = binaryReader.readBoolean();
  1094. a8k[80].b = binaryReader.readBoolean();
  1095. a8k[80].gr = binaryReader.readBoolean();
  1096. a8k[80].ye = binaryReader.readBoolean();
  1097. a8k[80].n = binaryReader.readUTF();
  1098. }
  1099. a8k[40] = binaryReader.readShort();
  1100. for (a8k[18] = 0; a8k[18] < a8k[40]; a8k[18]++) {
  1101. map.capZones[a8k[18]] = {"n":"Cap Zone","ty":1,"l":10,"i":-1};
  1102. map.capZones[a8k[18]].n = binaryReader.readUTF();
  1103. map.capZones[a8k[18]].l = binaryReader.readDouble();
  1104. map.capZones[a8k[18]].i = binaryReader.readShort();
  1105. if (map.v >= 6) {
  1106. map.capZones[a8k[18]].ty = binaryReader.readShort();
  1107. }
  1108. }
  1109. a8k[39] = binaryReader.readShort();
  1110. for (a8k[94] = 0; a8k[94] < a8k[39]; a8k[94]++) {
  1111. a8k[75] = binaryReader.readShort();
  1112. if (a8k[75] == 1) {
  1113. map.physics.joints[a8k[94]] = {"type":"rv","d":{"la":0,"ua":0,"mmt":0,"ms":0,"el":false,"em":false,"cc":false,"bf":0,"dl":true},"aa":[0,0]};
  1114. a8k[53] = map.physics.joints[a8k[94]];
  1115. a8k[53].d.la = binaryReader.readDouble();
  1116. a8k[53].d.ua = binaryReader.readDouble();
  1117. a8k[53].d.mmt = binaryReader.readDouble();
  1118. a8k[53].d.ms = binaryReader.readDouble();
  1119. a8k[53].d.el = binaryReader.readBoolean();
  1120. a8k[53].d.em = binaryReader.readBoolean();
  1121. a8k[53].aa = [binaryReader.readDouble(), binaryReader.readDouble()];
  1122. }
  1123. if (a8k[75] == 2) {
  1124. map.physics.joints[a8k[94]] = {"type":"d","d":{"fh":0,"dr":0,"cc":false,"bf":0,"dl":true},"aa":[0,0],"ab":[0,0]};
  1125. a8k[27] = map.physics.joints[a8k[94]];
  1126. a8k[27].d.fh = binaryReader.readDouble();
  1127. a8k[27].d.dr = binaryReader.readDouble();
  1128. a8k[27].aa = [binaryReader.readDouble(), binaryReader.readDouble()];
  1129. a8k[27].ab = [binaryReader.readDouble(), binaryReader.readDouble()];
  1130. }
  1131. if (a8k[75] == 3) {
  1132. map.physics.joints[a8k[94]] = {"type":"lpj","d":{"cc":false,"bf":0,"dl":true},"pax":0,"pay":0,"pa":0,"pf":0,"pl":0,"pu":0,"plen":0,"pms":0};
  1133. a8k[23] = map.physics.joints[a8k[94]];
  1134. a8k[23].pax = binaryReader.readDouble();
  1135. a8k[23].pay = binaryReader.readDouble();
  1136. a8k[23].pa = binaryReader.readDouble();
  1137. a8k[23].pf = binaryReader.readDouble();
  1138. a8k[23].pl = binaryReader.readDouble();
  1139. a8k[23].pu = binaryReader.readDouble();
  1140. a8k[23].plen = binaryReader.readDouble();
  1141. a8k[23].pms = binaryReader.readDouble();
  1142. }
  1143. if (a8k[75] == 4) {
  1144. map.physics.joints[a8k[94]] = {"type":"lsj","d":{"cc":false,"bf":0,"dl":true},"sax":0,"say":0,"sf":0,"slen":0};
  1145. a8k[47] = map.physics.joints[a8k[94]];
  1146. a8k[47].sax = binaryReader.readDouble();
  1147. a8k[47].say = binaryReader.readDouble();
  1148. a8k[47].sf = binaryReader.readDouble();
  1149. a8k[47].slen = binaryReader.readDouble();
  1150. }
  1151. map.physics.joints[a8k[94]].ba = binaryReader.readShort();
  1152. map.physics.joints[a8k[94]].bb = binaryReader.readShort();
  1153. map.physics.joints[a8k[94]].d.cc = binaryReader.readBoolean();
  1154. map.physics.joints[a8k[94]].d.bf = binaryReader.readDouble();
  1155. map.physics.joints[a8k[94]].d.dl = binaryReader.readBoolean();
  1156.  
  1157. }
  1158. return map;
  1159. };
  1160.  
  1161.  
  1162. scope.updateWssLog = function(){
  1163. if(!wsslogpaused){
  1164. if(logmenutable.children.length < wsssendrecievelog.length){
  1165. var bottomscroll = logmenutable.clientHeight + logmenutable.scrollTop >= logmenutable.scrollHeight-1;
  1166. while (logmenutable.children.length>1000) {
  1167. logmenutable.removeChild(logmenutable.firstChild);
  1168. logmenutable2.removeChild(logmenutable2.firstChild);
  1169. }
  1170. var loopthro = wsssendrecievelog.slice(packetcount);
  1171. for(var i = 0; i < loopthro.length;i++){
  1172. packetcount++;
  1173. var row = document.createElement("tr");
  1174. var row2 = document.createElement("tr");
  1175.  
  1176. var cell1 = document.createElement("td");
  1177. cell1.style["overflow-x"] = "scroll";
  1178. cell1.style["padding"] = "0px";
  1179. cell1.style["width"] = "100000px";
  1180.  
  1181. var cell2 = document.createElement("td");
  1182. cell2.style["overflow-x"] = "scroll";
  1183. cell2.style["padding"] = "0px";
  1184. cell2.style["width"] = "100000px";
  1185. if(debuggercount){
  1186. cell1.style["background"] = "rgb(178, 185, 189)";
  1187. debuggercount = false;
  1188. }
  1189. else{
  1190. cell2.style["background"] = "rgb(178, 185, 189)";
  1191. debuggercount = true;
  1192. }
  1193. cell1.textContent = loopthro[i][1];
  1194. cell2.textContent = loopthro[i][1];
  1195. if(loopthro[i][0] == 0){
  1196. cell2.style["color"] = "transparent";
  1197. cell1.onclick = function(){debuggerinput.value = this.textContent};
  1198. }
  1199. else{
  1200. cell1.style["color"] = "transparent";
  1201. cell2.onclick = function(){debuggerinput.value = this.textContent};
  1202. }
  1203. row.appendChild(cell1);
  1204. row2.appendChild(cell2);
  1205. logmenutable.appendChild(row);
  1206. logmenutable2.appendChild(row2);
  1207. }
  1208. while (logmenutable.children.length>1000) {
  1209. logmenutable.removeChild(logmenutable.firstChild);
  1210. logmenutable2.removeChild(logmenutable2.firstChild);
  1211. }
  1212. if(bottomscroll){
  1213. logmenutable.scrollTop = logmenutable.scrollHeight;
  1214. logmenutable2.scrollTop = logmenutable.scrollHeight;
  1215. }
  1216. }
  1217. }
  1218. };
  1219. Gdocument.getElementById("maploadwindowmapscontainer").appendChild = function(args){
  1220.  
  1221. var checkbox = Gdocument.createElement("input");
  1222. checkbox.type = "checkbox";
  1223. checkbox.style["position"]="absolute";
  1224. checkbox.style["margin-top"] = "135px";
  1225. checkbox.style["margin-left"] = "140px";
  1226. checkbox.style["scale"] = "2";
  1227. checkbox.style["display"] = "none";
  1228. checkbox.className = "quickplaycheckbox quickplayunchecked";
  1229. if(ishost && stopquickplay==0){
  1230. checkbox.style["display"] = "block";
  1231. checkbox.className = "quickplaycheckbox quickplaychecked";
  1232. }
  1233. checkbox.checked = true;
  1234. checkbox.onclick = function(e){e.stopPropagation();};
  1235. args.appendChild(checkbox);
  1236. originalMapLoad.call(this,args);
  1237. };
  1238. Gdocument.getElementById("newbonklobby_chat_content").appendChild = function(args){
  1239. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  1240. if(args.children[0].textContent.endsWith(" has left the game ") && args.children[0].textContent.startsWith("* ")){
  1241. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been kicked from the game ";
  1242. }
  1243. }
  1244. originalLobbyChat.call(this,args);
  1245. };
  1246. Gdocument.getElementById("ingamechatcontent").appendChild = function(args){
  1247. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  1248. if(args.children[0].textContent.endsWith(" has left the game.") && args.children[0].textContent.startsWith("* ")){
  1249. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been kicked from the game.";
  1250. }
  1251. }
  1252. if(recordedTimeStamp+100>Date.now() && args.children.length>0){
  1253. if(args.children[0].textContent.includes("seconds") && args.children[0].textContent.startsWith("* ")){
  1254. args.children[0].textContent = args.children[0].textContent + " - " + playerids[recordedId]
  1255. }
  1256. }
  1257. originalIngameChat.call(this,args);
  1258. };
  1259. Gwindow.XMLHttpRequest.prototype.open = function(_, url) {
  1260. if (url.includes("scripts/map_get") || url.includes("scripts/map_b1_get") || url.includes("scripts/hotmaps/")) {
  1261. this.isSearchMap = true;
  1262. }
  1263. originalXMLOpen.call(this, ...arguments);
  1264. };
  1265. Gwindow.XMLHttpRequest.prototype.send = function(data) {
  1266. if (this.isSearchMap) {
  1267. this.onreadystatechange = function () {
  1268. if (this.readyState == 4 && searchrequested && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS") {
  1269. searchrequested = false;
  1270. var jsonargs = {r:"success",maps:[],more:true};
  1271. for(var i = 0; i<requestedmaps.length; i++){
  1272. var dec = requestedmaps[i][0];
  1273. var undec = requestedmaps[i][1];
  1274. var map = {};
  1275. map.id = dec["m"]["dbid"];
  1276. map.name = dec["m"]["n"];
  1277. map.authorname = dec["m"]["a"];
  1278. map.leveldata = undec;
  1279. map.publisheddate = dec["m"]["date"];
  1280. map.remixauthor = dec["m"]["rxa"];
  1281. map.remixdb = dec["m"]["rxdb"];
  1282. map.remixid = dec["m"]["rxid"];
  1283. map.remixname = dec["m"]["rxn"];
  1284. map.vd = dec["m"]["vd"];
  1285. map.vu = dec["m"]["vu"];
  1286. jsonargs.maps.push(map);
  1287. }
  1288. jsonargs2 = JSON.stringify(jsonargs);
  1289. function stringifyjsonargs(){
  1290. return jsonargs2;
  1291. }
  1292. this.__defineGetter__("responseText", stringifyjsonargs);
  1293. this.__defineGetter__("response", stringifyjsonargs);
  1294. }
  1295. }
  1296. }
  1297. originalXMLSend.call(this, ...arguments);
  1298. };
  1299.  
  1300. Gwindow.WebSocket.prototype.send = function(args) {
  1301. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=")){
  1302. bonkwss = this;
  1303. wsssendlog.push(args);
  1304. wsssendrecievelog.push([0,args]);
  1305. if(typeof(args) == "string"){
  1306. if(args.startsWith('42[26,')){
  1307. if(sandboxon){
  1308. var jsonargs = JSON.parse(args.substring(2))[1];
  1309. if(typeof(sandboxplayerids[jsonargs["targetID"]])!='undefined'){
  1310. RECIEVE('42[18,'+jsonargs["targetID"]+','+jsonargs["targetTeam"]+']');
  1311.  
  1312. }
  1313. }
  1314. }
  1315. if(args.startsWith('42[1,')){
  1316. return;
  1317. }
  1318.  
  1319. if(args.startsWith('42[4,')){
  1320. var jsonargs = JSON.parse(args.substring(2));
  1321. if(sandboxcopyme && typeof(jsonargs[1]["type"])=="undefined"){
  1322. var jsonkeys = Object.keys(sandboxplayerids);
  1323. for(var i = 0; i<jsonkeys.length;i++){
  1324. RECIEVE('42[7,'+jsonkeys[i].toString()+','+JSON.stringify(jsonargs[1])+']');
  1325. }
  1326. }
  1327. args = "42"+JSON.stringify(jsonargs);
  1328. }
  1329. if(args.startsWith('42[12,')){
  1330. playerids["0"] = username;
  1331. }
  1332. if(args.startsWith('42[23,')){
  1333. var jsonargs = JSON.parse(args.substring(2));
  1334. var map = decodeFromDatabase(jsonargs[1]["m"]);
  1335. var spawns = map["spawns"];
  1336. var caps = map["capZones"];
  1337. var teamsneeded = true;
  1338. var ffacaps = false;
  1339. var ffaforsure = false;
  1340. for(var i = 0; i<caps.length;i++){
  1341. var currentCap = caps[i];
  1342. if(currentCap.ty==0){
  1343. ffacaps = true;
  1344. }
  1345. }
  1346. var excludedindexes = [];
  1347. var ffaspawns = false;
  1348. for(var i = 0; i<spawns.length;i++){
  1349. var currentSpawn = spawns[i];
  1350. if(currentSpawn.f){
  1351. ffaspawns = true;
  1352. }
  1353. if(currentSpawn.f && !(currentSpawn.r || currentSpawn.b || currentSpawn.gr || currentSpawn.ye)){
  1354. excludedindexes.push(i);
  1355. }
  1356. if(Math.sqrt(currentSpawn.x**2 + currentSpawn.y**2)>=850 && currentSpawn.y>250){
  1357. excludedindexes.push(i);
  1358. }
  1359. else if(!(currentSpawn.f || currentSpawn.r || currentSpawn.b || currentSpawn.gr || currentSpawn.ye)){
  1360. excludedindexes.push(i);
  1361. }
  1362. }
  1363. if((!(ffaspawns && (spawns.length>0)) || (!ffacaps && (caps.length > 0))) && !ffaforsure){
  1364. teamsneeded = true;
  1365. }
  1366. else{
  1367. teamsneeded = false;
  1368. }
  1369. if(teamsneeded){
  1370. var newspawns = [];
  1371. for(var i = 0; i<spawns.length;i++){
  1372. if(!excludedindexes.includes(i)){
  1373. newspawns.push(spawns[i]);
  1374. }
  1375. }
  1376. newspawns.sort(function(a,b){return b.priority - a.priority});
  1377. }
  1378. }
  1379.  
  1380. if(args.startsWith('42[47,') && stopquickplay == 0 && ishost && document.hidden){
  1381. if(shuffle){
  1382. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  1383. var available = [];
  1384. var availableindexes = [];
  1385. var notempty = false;
  1386. for(var i = 0; i<e2.length;i++){
  1387. var a = false;
  1388. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  1389. available.push(a);
  1390. if(a){
  1391. availableindexes.push(i);
  1392. notempty = true;
  1393. }
  1394. }
  1395. if(notempty){
  1396.  
  1397. if(availableindexes.length!=1){
  1398. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  1399. }
  1400. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  1401. }
  1402. }
  1403. else{
  1404. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  1405. var available = [];
  1406. var availableindexes = [];
  1407. var notempty = false;
  1408. for(var i = 0; i<e2.length;i++){
  1409. var a = false;
  1410. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  1411. available.push(a);
  1412. if(a){
  1413. availableindexes.push(i);
  1414. notempty = true;
  1415. }
  1416. }
  1417. if(notempty){
  1418. var above = [];
  1419. for(var i = 0;i<availableindexes.length;i++){
  1420. if(availableindexes[i]>quicki){
  1421. above.push(availableindexes[i]);
  1422. }
  1423. }
  1424. if(above.length>0){
  1425. quicki = above[0];
  1426. }
  1427. else{
  1428. quicki = availableindexes[0];
  1429. }
  1430. }
  1431. }
  1432. canceled = false;
  1433. startedinqp = true;
  1434. window.map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length),0);
  1435. }
  1436.  
  1437. if(args.startsWith('42[5,')){
  1438. var jsonargs = JSON.parse(args.substring(2));
  1439. if(stopquickplay!=1 && startedinqp){
  1440. startedinqp = false;
  1441. jsonargs[1]["gs"]["wl"] = 999;
  1442. if(!instaqp){
  1443. var jsonargs2 = decodeIS(jsonargs[1]["is"]);
  1444. jsonargs2["ftu"] = 60;
  1445. if(jsonargs2["mm"]["rxa"] != ""){
  1446. jsonargs2["mm"]["a"] = jsonargs2["mm"]["rxa"];
  1447. jsonargs2["mm"]["n"] = jsonargs2["mm"]["rxn"];
  1448. }
  1449. jsonargs2 = encodeIS(jsonargs2);
  1450. jsonargs[1]["is"] = jsonargs2;
  1451. var jsonargs3 = decodeFromDatabase(jsonargs[1]["gs"]["map"]);
  1452. jsonargs3["m"]["a"] = jsonargs3["m"]["rxa"];
  1453. jsonargs3["m"]["n"] = jsonargs3["m"]["rxn"];
  1454.  
  1455. jsonargs3 = encodeToDatabase(jsonargs3);
  1456. jsonargs[1]["gs"]["map"] = jsonargs3;
  1457. }
  1458. }
  1459.  
  1460. args = "42"+JSON.stringify(jsonargs);
  1461. }
  1462. }
  1463.  
  1464. }
  1465. else{
  1466. this.onmessage = function(args){return;};
  1467. return;
  1468.  
  1469. }
  1470. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=") && !this.injected){
  1471. this.injected = true;
  1472.  
  1473. var originalRecieve = this.onmessage;
  1474. this.onmessage = function(args){
  1475. wssrecievelog.push(args.data);
  1476. wsssendrecievelog.push([1,args.data]);
  1477. if(typeof(args.data)=="string"){
  1478. if(args.data.startsWith('42[1,')){
  1479. var jsonargs = JSON.parse(args.data.substring(2));
  1480. originalSend.call(this,'42[1,{"id":'+jsonargs[2]+'}]');
  1481. }
  1482. if(args.data.startsWith('42[24,')){
  1483. beenKickedTimeStamp = Date.now();
  1484. }
  1485. if(args.data.startsWith('42[6,')){
  1486. var jsonargs = JSON.parse(args.data.substring(2));
  1487. if(typeof(playerids[jsonargs[1]])!='undefined'){
  1488. delete playerids[jsonargs[1]];
  1489. }
  1490. }
  1491. if(args.data.startsWith('42[32')){
  1492. SEND('42[4,{"type":"inactive kick counter"}]');
  1493. }
  1494. if(args.data.startsWith('42[40,')){
  1495. recordedTimeStamp = Date.now();
  1496. recordedId = JSON.parse(args.data.substring(2))[1];
  1497. }
  1498. if(args.data.startsWith('42[3,')){
  1499. var jsonargs = JSON.parse(args.data.substring(2));
  1500. for(var i = 0; i<jsonargs[3].length;i++){
  1501. if(jsonargs[3][i]!=null){
  1502. playerids[i.toString()] = jsonargs[3][i]["userName"];
  1503. }
  1504. }
  1505. }
  1506. if(args.data.startsWith('42[15,')){
  1507. var jsonargs = JSON.parse(args.data.substring(2));
  1508. gameStartTimeStamp = jsonargs[1];
  1509. }
  1510. if(args.data.startsWith('42[33,')){
  1511. var jsonargs = JSON.parse(args.data.substring(2));
  1512. var decodedmap = decodeFromDatabase(jsonargs[1]);
  1513. if(decodedmap!=0){
  1514. requestedmaps.push([decodedmap,jsonargs[1]]);
  1515. }
  1516. }
  1517. if(args.data.startsWith('42[7,')){
  1518. var jsonargs2 = JSON.parse(args.data.substring(2));
  1519. var idofpacket = jsonargs2[1];
  1520. jsonargs = jsonargs2[2];
  1521. if(typeof(jsonargs["type"]) != "undefined"){
  1522. if(jsonargs["type"]=="private chat" && jsonargs["to"] == username){
  1523. from = jsonargs["from"];
  1524. if(Object.keys(playerids).includes(idofpacket.toString())){
  1525. from = playerids[idofpacket];
  1526. }
  1527. if(!ignorepmlist.includes(from)){
  1528. if(typeof(jsonargs["message"])=="object" && typeof(jsonargs["password"]) == "object"){
  1529. if(public_key[0]==jsonargs["public key"][0] && public_key[1]==jsonargs["public key"][1]){
  1530. if(jsonargs["password"].length<=25){
  1531. var password = CRYPT_MESSAGE(private_key,jsonargs["password"]);
  1532. var decodedtext = jsonargs["message"].slice(0,400);
  1533. var encodedtext = "";
  1534. for(var i=0;i<decodedtext.length;i++){
  1535. if(password[i%password.length]<1000){
  1536. encodedtext+=String.fromCharCode(password[i%password.length]^decodedtext[i]);
  1537. }
  1538. }
  1539. var code = 'Gwindow.private_chat = "'+from+'"; Gwindow.SEND("42"+JSON.stringify([4,{"type":"request public key","from":Gwindow.username,"to":Gwindow.private_chat}])); Gwindow.request_public_key_time_stamp = Date.now(); setTimeout(function(){if(Gwindow.private_chat_public_key[0]!=Gwindow.private_chat){Gwindow.displayInChat("Failed to connect to "+Gwindow.private_chat+".","#DA0808","#1EBCC1");Gwindow.private_chat = Gwindow.private_chat_public_key[0];}},1600);';
  1540. displayInChat('> '+'<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">'+from+'</a>'+': ',"#DA0808","#1EBCC1",{sanitize:false},encodedtext);
  1541.  
  1542. Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true;
  1543. Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true;
  1544. Laster_message = lastmessage();
  1545. }
  1546. }
  1547. else{
  1548. SEND("42"+JSON.stringify([4,{"type":"public key correction","from":username,"to":private_chat_public_key[0],"public key":public_key}]));
  1549. }
  1550. }
  1551. }
  1552. }
  1553. if(jsonargs["type"]=="request public key" && jsonargs["to"] == username){
  1554. SEND("42"+JSON.stringify([4,{"type":"public key","from":username,"public key":public_key}]));
  1555. }
  1556. if(jsonargs["type"]=="private chat users" && pmuserstimestamp+1500>Date.now()){
  1557. if(typeof(jsonargs["from"])!='undefined'){
  1558. from = jsonargs["from"];
  1559. if(Object.keys(playerids).includes(idofpacket.toString())){
  1560. from = playerids[idofpacket];
  1561. }
  1562. if(!pmusers.includes(from) && username == jsonargs["to"]){
  1563. pmusers.push(from);
  1564. }
  1565. }
  1566. }
  1567. if(jsonargs["type"]=="request private chat users"){
  1568. if(typeof(jsonargs["from"])!='undefined'){
  1569. from = jsonargs["from"];
  1570. if(Object.keys(playerids).includes(idofpacket.toString())){
  1571. from = playerids[idofpacket];
  1572. }
  1573. SEND("42"+JSON.stringify([4,{"type":"private chat users","from":username,"to":from}]));
  1574. }
  1575. }
  1576. if(jsonargs["type"]=="public key" && request_public_key_time_stamp+1500>Date.now()){
  1577. from = jsonargs["from"];
  1578. if(Object.keys(playerids).includes(idofpacket.toString())){
  1579. from = playerids[idofpacket];
  1580. }
  1581. if(from == private_chat){
  1582. private_chat_public_key = [private_chat,jsonargs["public key"]];
  1583. displayInChat("Private chatting with "+private_chat+".","#DA0808","#1EBCC1");
  1584. }
  1585.  
  1586. }
  1587. if(jsonargs["type"]=="public key correction" && private_chat_public_key[0] == private_chat){
  1588. from = jsonargs["from"];
  1589. if(Object.keys(playerids).includes(idofpacket.toString())){
  1590. from = playerids[idofpacket];
  1591. }
  1592. if(from == private_chat){
  1593. private_chat_public_key = [private_chat,jsonargs["public key"]];
  1594. var text = pmlastmessage;
  1595. var password = [];
  1596. for(var i = 0;i<10;i++){
  1597. password.push(Math.floor(Math.random()*100+50));
  1598. }
  1599. var text2 = [];
  1600. for(var i = 0;i<text.length ;i++){
  1601. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  1602. }
  1603. SEND("42"+JSON.stringify([4,{"type":"private chat","from":username,"to":private_chat,"public key":private_chat_public_key[1],"message":text2,"password":CRYPT_MESSAGE(private_chat_public_key[1],password)}]));
  1604. }
  1605. }
  1606.  
  1607. }
  1608. else{
  1609. gameStartTimeStamp = Date.now()-1000*jsonargs["f"]/30;
  1610. }
  1611. }
  1612.  
  1613. if(args.data.startsWith('42[4,')){
  1614. var jsonargs = JSON.parse(args.data.substring(2));
  1615. playerids[jsonargs[1]] = jsonargs[3];
  1616.  
  1617. }
  1618. if(args.data.startsWith('42[5,')){
  1619. var jsonargs = JSON.parse(args.data.substring(2));
  1620. if(typeof(playerids[jsonargs[1]])!='undefined'){
  1621. delete playerids[jsonargs[1]];
  1622. }
  1623. }
  1624. }
  1625. return originalRecieve.call(this,args);
  1626. };
  1627.  
  1628. var originalClose = this.onclose;
  1629. this.onclose = function () {
  1630. window.bonkwss = 0;
  1631. return originalClose.call(this);
  1632. }
  1633.  
  1634. }
  1635. return originalSend.call(this,args);
  1636. };
  1637.  
  1638. scope.SEND = function(args){
  1639. if(bonkwss!=0){
  1640. bonkwss.send(args);
  1641. }
  1642. };
  1643. scope.RECIEVE = function(args){
  1644. if(bonkwss!=0){
  1645. bonkwss.onmessage({data:args});
  1646. }
  1647. };
  1648. Gdocument.getElementById("ingamechatcontent").style["pointer-events"]="all";
  1649. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  1650. Gdocument.getElementById("ingamechatcontent").style["height"]="128px";
  1651. Gdocument.getElementById("ingamechatbox").style["height"]="250px";
  1652.  
  1653. document.getElementById('adboxverticalCurse').style["display"] = "none";
  1654. document.getElementById('adboxverticalleftCurse').style["display"] = "none";
  1655.  
  1656.  
  1657. scope.dontswitch = false;
  1658. scope.username = 0;
  1659. scope.timedelay = 1400;
  1660. scope.ishost = false;
  1661. scope.checkboxhidden = true;
  1662. scope.quicki=0;
  1663. scope.defaultmode = "d";
  1664. scope.recmodebool = false;
  1665. scope.shuffle = false;
  1666. scope.startedinqp = false;
  1667. scope.instaqp = false;
  1668. scope.freejoin = false;
  1669. scope.recordedTimeStamp = 0;
  1670. scope.recordedId = 0;
  1671. scope.smartteams = false;
  1672. scope.beenKickedTimeStamp = 0;
  1673. scope.stopquickplay = 1;
  1674. scope.currentFrame = 0;
  1675. scope.text2speech = false;
  1676. scope.gameStartTimeStamp = 0;
  1677. scope.canceled = false;
  1678. scope.banned = [];
  1679. scope.transitioning = false;
  1680. scope.echo_list = [];
  1681. scope.echoAppend = "";
  1682. scope.message = "";
  1683. scope.mode = "";
  1684. scope.private_chat = "";
  1685. scope.private_chat_public_key = ["",[0,0]];
  1686. scope.users = [];
  1687. scope.pmusers = [];
  1688. scope.pmlastmessage = "";
  1689. scope.pmuserstimestamp = 0;
  1690. scope.ignorepmlist = [];
  1691. scope.scroll = false;
  1692. scope.elem = Gdocument.getElementById("maploadwindowmapscontainer");
  1693. scope.npermissions = 1;
  1694. scope.space_flag = false;
  1695. scope.rcaps_flag = false;
  1696. scope.number_flag = false;
  1697. scope.request_public_key_time_stamp = 0;
  1698. scope.sandboxcopyme = false;
  1699. scope.help = ["All the commands are:","/help","/?","/advhelp [command]","/space","/rcaps","/number","/speech","/echo [username]","/clearecho","/remove [username]","/echoappend [text]","/chatw [username]","/msg [text]","/ignorepm [username]","/pmusers","/lobby","/team [letter]","/scroll","/hidechat","/showchat","/notify","/stopnotify","Host commands are:","/startqp","/stopqp","/next","/previous","/shuffle","/instaqp","/freejoin","/recmode","/defaultmode [mode]","/start","/balanceA [number]","/moveA [letter]","/rounds [number]","/mode [mode]","/ban [username]","/kill [username]","Sandbox commands are:","/addplayer [number]","/delplayer [number]","/copyme","Debugging commands are:","/eval [code]","/debugger","Hotkeys are:","Alt L","Alt C","Host hotkeys are:","Alt S","Alt T","Alt E","Alt K","Alt M","Alt Q","Alt A","Alt D","Alt F","Alt R","Alt I"];
  1700.  
  1701. scope.adv_help = {"help":"Shows all command names.",
  1702. "?":"Shows all command names.",
  1703. "advhelp":"Shows a command in detail.",
  1704. "space":"Toggles space. When space is on, whatever you type will be spaced apart.",
  1705. "rcaps":"Toggles rcaps. When rcaps is on, each letter will randomly get capitalized.",
  1706. "number":"Toggles number. When number is on, 'a' becomes 4, 'e' becomes 3, 's' becomes 5, 'o' becomes 0, 'l' and 'i' become 1.",
  1707. "speech":"Turns on text to speech for the chat.",
  1708. "echo":"Echoes a username. It copies the username's chat messages.",
  1709. "echoappend":"Appends the text to the end of each echo.",
  1710. "remove":"Removes username from echo list. You will not echo that username anymore.",
  1711. "clearecho":"Clears echo list. You will not echo anyone anymore.",
  1712. "chatw":"It private chats with username. Type /msg to message that username.",
  1713. "msg":"Messages with what username you are chatting with. Type /chatw to chat with a username.",
  1714. "ignorepm":"Ignores the username's private chat messages. To unignore, type /ignorepm [username].",
  1715. "pmusers":"Dispays who you can private chat with.",
  1716. "eval":"Evaluates code. Only use this if you are experienced in javascript.",
  1717. "debugger":"Opens debugger.",
  1718. "lobby":"Makes lobby visible when you are ingame. Type /lobby again to close lobby.",
  1719. "team":"Joins a specific team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  1720. "scroll":"Toggles a scrollbar in ingame chat.",
  1721. "hidechat":"Hides ingame chat. Type /showchat to show it again.",
  1722. "showchat":"Shows ingame chat. /hidechat hides the chat.",
  1723. "notify":"You will be notified if a person types @MYUSERNAME",
  1724. "stopnotify":"You will not be notified if a person types @MYUSERNAME",
  1725. "startqp":"Starts cycling maps in your map menu.",
  1726. "stopqp":"Stops cycling maps in your map menu.",
  1727. "next":"Skips the map. Usable only with /startqp.",
  1728. "previous":"Goes to previous map. Usable only with /startqp.",
  1729. "shuffle":"Makes quickplay play random maps instead of in order.",
  1730. "freejoin":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing.",
  1731. "recmode":"In quickplay, it switches mode to recommended mode, according to editor.",
  1732. "defaultmode":"Switches mode to defaultmode if there is no recmode.",
  1733. "start":"Starts game instantly.",
  1734. "instaqp":"Rounds will instantly start without a countdown.",
  1735. "balanceA":"Balances everyone with balance number.",
  1736. "moveA":"Sets everyones team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  1737. "rounds":"Sets rounds to win.",
  1738. "mode":"Switches modes.",
  1739. "ban":"Bans username from lobby. If they rejoin, it automatically bans.",
  1740. "kill":"Kills the person ingame.",
  1741. "addplayer":"In sandbox, it adds players.",
  1742. "delplayer":"In sandbox, it deletes players.",
  1743. "copyme":"In sandbox, it makes each player copy your movements.",
  1744. "Alt L":"Makes lobby visible when you are ingame. Press Alt L again to close lobby.",
  1745. "Alt C":"Hides ingame chat. Press Alt C again to show ingame chat.",
  1746. "Alt S":"Starts game instantly.",
  1747. "Alt T":"Toggles teams.",
  1748. "Alt E":"Toggles editor.",
  1749. "Alt K":"Exits ingame and returns to lobby.",
  1750. "Alt M":"Switches modes.",
  1751. "Alt Q":"Toggles quickplay.",
  1752. "Alt A":"Skips the map if quickplay is on.",
  1753. "Alt D":"Goes to previous map if quickplay is on.",
  1754. "Alt F":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing",
  1755. "Alt R":"In quickplay, it switches mode to recommended mode, according to editor.",
  1756. "Alt I":"Opens debugger."
  1757. };
  1758.  
  1759. elem.onclick=function(e){
  1760. if(stopquickplay==0 && ishost == true && e.isTrusted == true){
  1761. quicki = (Array.from(e.target.parentElement.parentNode.children).indexOf(e.target.parentNode)-1)%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  1762. }
  1763. };
  1764. scope.urlify = function(text) {
  1765. return text.replace(/(?:https?:\/\/)?(?:[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)(?:\.[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)+(?:\/(?:[A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]|%[0-9a-fA-F]{2})*)?(?:\?(?:[^=]+=[^&](?:&[^=]+=[^&])*)?)?/g, function(url) {
  1766. if(url.startsWith('https://')){return '<a href="' + url + '" target="_blank" style = "color:orange">' + url + '</a>';}
  1767. else{return '<a href="https://' + url + '" target="_blank" style = "color:orange">' + url + '</a>';}
  1768. })
  1769. };
  1770.  
  1771. scope.fire = function(type,options,d = Gdocument){
  1772. var event=new CustomEvent(type);
  1773. for(var p in options){
  1774. event[p]=options[p];
  1775. }
  1776. d.dispatchEvent(event);
  1777. };
  1778.  
  1779. scope.chat = function(message){
  1780. mess = Gdocument.getElementById("newbonklobby_chat_input").value;
  1781. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  1782. Gdocument.getElementById("newbonklobby_chat_input").value = message;
  1783. Gdocument.getElementById("ingamechatinputtext").value = message;
  1784. fire("keydown",{keyCode:13});
  1785. fire("keydown",{keyCode:13});
  1786. Gdocument.getElementById("newbonklobby_chat_input").value = mess;
  1787. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  1788. };
  1789. scope.displayInChat = function(message, LobbyColor, InGameColor, options, message2) {
  1790. options = options ?? {};
  1791. message2 = message2 ?? "";
  1792. LobbyColor = LobbyColor ?? "#8800FF";
  1793. InGameColor = InGameColor ?? "#AA88FF";
  1794. let A = Gdocument.createElement("div");
  1795. let B = Gdocument.createElement("span");
  1796. B.className = "newbonklobby_chat_status";
  1797. B.style.color = LobbyColor;
  1798. A.appendChild(B);
  1799. B.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  1800. B.innerHTML+=urlify(message2.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;'));
  1801. let C = Gdocument.createElement("div");
  1802. let D = Gdocument.createElement("span");
  1803. D.style.color = InGameColor;
  1804. C.appendChild(D);
  1805. D.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  1806. D.innerHTML+=urlify(message2.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;'));
  1807.  
  1808. let a = false;
  1809. if(Gdocument.getElementById("newbonklobby_chat_content").clientHeight + Gdocument.getElementById("newbonklobby_chat_content").scrollTop >= Gdocument.getElementById("newbonklobby_chat_content").scrollHeight-1) {
  1810. a = true;
  1811. }
  1812. Gdocument.getElementById("newbonklobby_chat_content").appendChild(A);
  1813. Gdocument.getElementById("ingamechatcontent").appendChild(C);
  1814. if (a) { Gdocument.getElementById("newbonklobby_chat_content").scrollTop = Number.MAX_SAFE_INTEGER;};
  1815. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  1816. chat("");
  1817. };
  1818.  
  1819. scope.lobby = function(){
  1820. if (Gdocument.getElementById("newbonklobby").style["display"]=="none"){
  1821.  
  1822. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1823. Gdocument.getElementById("mapeditor_close").click();
  1824. if(Gdocument.getElementsByClassName("newbonklobby_playerentry").length>0){
  1825. Gdocument.getElementById("newbonklobby").style["z-index"]=1;
  1826. Gdocument.getElementById("maploadwindowcontainer").style["z-index"]=1;
  1827. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=1;
  1828. Gdocument.getElementById("pretty_top").style["z-index"]=3;
  1829. Gdocument.getElementById("settingsContainer").style["z-index"]=3;
  1830. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=3;
  1831. Gdocument.getElementById("hostleaveconfirmwindow").style["z-index"]=3;
  1832. debuggermenu.style["z-index"] = 2;
  1833. }
  1834. else{
  1835. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  1836. Gdocument.getElementById("newbonklobby").style["display"]="none";
  1837. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  1838.  
  1839. }
  1840.  
  1841. }
  1842. else if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  1843. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  1844. Gdocument.getElementById("newbonklobby").style["display"]="none";
  1845. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  1846.  
  1847. }
  1848. };
  1849.  
  1850. scope.lastmessage = function(){
  1851. if(Gdocument.getElementById("newbonklobby_chat_content").children.length!=0){
  1852. var lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  1853. var lm2 = "";
  1854. for(var i = 0; i<lm.length;i++){
  1855. lm2+=" "+lm[i].textContent.trim();
  1856. }
  1857. lm2 = lm2.trim();
  1858. if(lm2.startsWith("*")){
  1859. return lm2;
  1860. }
  1861. }
  1862. if(Gdocument.getElementById("ingamechatcontent").children.length!=0){
  1863. var lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  1864. var lm2 = "";
  1865. for(var i = 0; i<lm.length;i++){
  1866. lm2+=" "+lm[i].textContent.trim();
  1867. }
  1868. return lm2.trim();
  1869. }
  1870. return "";
  1871.  
  1872. };
  1873. scope.map = function(e,t=timedelay){
  1874. if(e<0){
  1875. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  1876. quicki = 0;
  1877. return;
  1878. }
  1879. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  1880. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  1881. return;
  1882. }
  1883.  
  1884. setTimeout(function(){if(!canceled){
  1885. startedinqp = true;
  1886. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  1887. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1888. if(recmodebool && ishost){
  1889. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  1890. if(mode == "" && defaultmode!="d"){
  1891. mode = defaultmode;
  1892. }
  1893. if(mode != ""){
  1894. RECIEVE('42[26,"b","'+mode+'"]');
  1895. }
  1896. }
  1897. var displayblock = Gdocument.getElementById("newbonklobby").style["display"] == "block";
  1898. Gdocument.getElementById("mapeditorcontainer").style["display"] = "none";
  1899. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1900. if(displayblock){
  1901. Gdocument.getElementById("newbonklobby").style["display"] = "block";
  1902. }
  1903. Gdocument.getElementById("mapeditor_midbox_testbutton").click();}
  1904. canceled = false;
  1905. transitioning = false;
  1906. },t);
  1907.  
  1908. };
  1909.  
  1910. scope.gotonextmap = function(e){
  1911. if(e<0){
  1912. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  1913. quicki = 0;
  1914. return;
  1915. }
  1916. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  1917. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  1918. return;
  1919. }
  1920. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  1921. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1922. if(recmodebool && ishost){
  1923. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  1924. if(mode == "" && defaultmode!="d"){
  1925. mode = defaultmode;
  1926. }
  1927. if(mode != ""){
  1928. RECIEVE('42[26,"b","'+mode+'"]');
  1929. }
  1930. }
  1931. startedinqp = true;
  1932. var displayblock = Gdocument.getElementById("newbonklobby").style["display"] == "block";
  1933. Gdocument.getElementById("mapeditorcontainer").style["display"] = "none";
  1934. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1935. if(displayblock){
  1936. Gdocument.getElementById("newbonklobby").style["display"] = "block";
  1937. }
  1938. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  1939. Gdocument.getElementById("newbonklobby").style["visibility"] = "visible";
  1940. };
  1941. scope.commandhandle = function(chat_val){
  1942. if (chat_val.substring(1,6)=="echo " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  1943. if (chat_val.substring(6).replace(/^\s+|\s+$/g, '')==username){
  1944. displayInChat("You cannot echo yourself.","#DA0808","#1EBCC1");
  1945. return "";
  1946. }
  1947. else if (echo_list.indexOf(chat_val.substring(6).replace(/^\s+|\s+$/g, ''))===-1) {
  1948.  
  1949. echo_list.push(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  1950. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is being echoed.","#DA0808","#1EBCC1");
  1951. return "";
  1952. }
  1953. else{
  1954. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is already being echoed.","#DA0808","#1EBCC1");
  1955. return "";
  1956. }
  1957. }
  1958. else if (chat_val.substring(1,8)=="remove " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  1959. if (echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, ''))!==-1){
  1960. echo_list.splice(echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, '')),1);
  1961. displayInChat(chat_val.substring(7).replace(/^\s+|\s+$/g, '')+" is not being echoed.","#DA0808","#1EBCC1");
  1962. return "";
  1963. }
  1964. else{
  1965. displayInChat("You cannot remove someone that you didn't echo.","#DA0808","#1EBCC1");
  1966. return "";
  1967. }
  1968.  
  1969. }
  1970. else if (chat_val.substring(1,12)=="echoappend " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  1971. echoAppend = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  1972. displayInChat(echoAppend +" will be appended to each echo. Type \"/echoappend\" to reset echoappend.","#DA0808","#1EBCC1");
  1973. return "";
  1974.  
  1975. }
  1976. else if (chat_val.substring(1,11)=="echoappend"){
  1977. echoAppend = "";
  1978. displayInChat("Reset echoappend.","#DA0808","#1EBCC1");
  1979. return "";
  1980.  
  1981. }
  1982. else if (chat_val.substring(1,10)=="clearecho"){
  1983. echo_list = [];
  1984. displayInChat("Cleared the echo list.","#DA0808","#1EBCC1");
  1985. return "";
  1986. }
  1987. else if (chat_val.substring(1,6)=="space"){
  1988. if(space_flag == true){
  1989. displayInChat("Space is now off.","#DA0808","#1EBCC1");
  1990. space_flag = false;
  1991. }
  1992. else{
  1993. displayInChat("Space is now on.","#DA0808","#1EBCC1");
  1994. space_flag = true;
  1995. }
  1996. return "";
  1997. }
  1998. else if (chat_val.substring(1,6)=="rcaps"){
  1999. if(rcaps_flag == true){
  2000. displayInChat("Rcaps is now off.","#DA0808","#1EBCC1");
  2001. rcaps_flag = false;
  2002. }
  2003. else{
  2004. displayInChat("Rcaps is now on.","#DA0808","#1EBCC1");
  2005. rcaps_flag = true;
  2006. }
  2007.  
  2008. return "";
  2009. }
  2010. else if (chat_val.substring(1,7)=="number"){
  2011. if(number_flag == true){
  2012. displayInChat("Number is now off.","#DA0808","#1EBCC1");
  2013. number_flag = false;
  2014. }
  2015. else{
  2016. displayInChat("Number is now on.","#DA0808","#1EBCC1");
  2017. number_flag = true;
  2018. }
  2019.  
  2020. return "";
  2021. }
  2022. else if (chat_val.substring(1,7)=="speech"){
  2023. if(text2speech == true){
  2024. displayInChat("Text to speech is now off.","#DA0808","#1EBCC1");
  2025. text2speech = false;
  2026. }
  2027. else{
  2028. displayInChat("Text to speech is now on.","#DA0808","#1EBCC1");
  2029. text2speech = true;
  2030. }
  2031.  
  2032. return "";
  2033. }
  2034. else if (chat_val.substring(1,6)=="eval " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  2035. var ev = "";
  2036. try{
  2037. ev = eval(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  2038. }
  2039. catch(e){
  2040. displayInChat(e.message,"#DA0808","#1EBCC1");
  2041. }
  2042. try{
  2043. displayInChat(ev.toString(),"#DA0808","#1EBCC1");
  2044. }
  2045. catch{
  2046. }
  2047.  
  2048. return "";
  2049.  
  2050. }
  2051.  
  2052. else if (chat_val.substring(1,9)=="hidechat"){
  2053. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  2054. return "";
  2055. }
  2056. else if (chat_val.substring(1,9)=="showchat"){
  2057. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  2058. return "";
  2059. }
  2060.  
  2061. else if (chat_val.substring(1,7)=="scroll"){
  2062. if(scroll==false){
  2063. scroll = true;
  2064. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="scroll";
  2065. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  2066. }
  2067. else if(scroll==true){
  2068. scroll = false;
  2069. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="hidden";
  2070. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  2071. }
  2072.  
  2073. return "";
  2074. }
  2075.  
  2076. else if (chat_val.substring(1,7)=="chatw "){
  2077. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  2078.  
  2079. if(username == text){
  2080. displayInChat("You cannot private chat with yourself.","#DA0808","#1EBCC1");
  2081. return "";
  2082. }
  2083. private_chat = text;
  2084.  
  2085. SEND("42"+JSON.stringify([4,{"type":"request public key","from":username,"to":private_chat}]));
  2086. request_public_key_time_stamp = Date.now();
  2087. 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);
  2088. return "";
  2089. }
  2090.  
  2091. else if (chat_val.substring(1,5)=="msg " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  2092. if(private_chat_public_key[1][0] != 0 && private_chat_public_key[1][1] != 0 && private_chat_public_key[0] == private_chat){
  2093. var text = chat_val.substring(5).replace(/^\s+|\s+$/g, '');
  2094. var password = [];
  2095. for(var i = 0;i<10;i++){
  2096. password.push(Math.floor(Math.random()*100+50));
  2097. }
  2098. var text2 = [];
  2099. for(var i = 0;i<text.slice(0,400).length ;i++){
  2100. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  2101. }
  2102. pmlastmessage = text.slice(0,400);
  2103. SEND("42"+JSON.stringify([4,{"type":"private chat","from":username,"to":private_chat,"public key":private_chat_public_key[1],"message":text2,"password":CRYPT_MESSAGE(private_chat_public_key[1],password)}]));
  2104. displayInChat("> "+username+": "+text,"#DA0808","#1EBCC1");
  2105.  
  2106. }
  2107. return "";
  2108. }
  2109. else if (chat_val.substring(1,10)=="ignorepm " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  2110. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  2111. if(ignorepmlist.includes(text)){
  2112. var index = ignorepmlist.indexOf(text);
  2113. ignorepmlist.splice(index,1);
  2114. displayInChat("You are not ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  2115.  
  2116. }
  2117. else{
  2118. ignorepmlist.push(text);
  2119. displayInChat("You are now ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  2120. }
  2121. return "";
  2122. }
  2123. else if (chat_val.substring(1,8)=="pmusers"){
  2124. pmusers = [];
  2125. SEND("42"+JSON.stringify([4,{"type":"request private chat users","from":username}]));
  2126. pmuserstimestamp = Date.now();
  2127. setTimeout(function(){if(pmusers.length == 0){displayInChat("You cannot private chat with anyone.","#DA0808","#1EBCC1");
  2128. }else{displayInChat("You can private chat with:","#DA0808","#1EBCC1");for(var i = 0;i<pmusers.length;i++){var code = 'Gwindow.private_chat = "'+pmusers[i]+'"; Gwindow.SEND("42"+JSON.stringify([4,{"type":"request public key","from":Gwindow.username,"to":Gwindow.private_chat}])); Gwindow.request_public_key_time_stamp = Date.now(); setTimeout(function(){if(Gwindow.private_chat_public_key[0]!=Gwindow.private_chat){Gwindow.displayInChat("Failed to connect to "+Gwindow.private_chat+".","#DA0808","#1EBCC1");Gwindow.private_chat = Gwindow.private_chat_public_key[0];}},1600);';displayInChat('<a onclick = \''+code+'\' href = "javascript:void(0);" style = "color:green">'+pmusers[i]+'</a>',"#DA0808","#1EBCC1",{sanitize:false}); Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true; Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true; Laster_message = lastmessage(); }}},1600);
  2129. return "";
  2130. }
  2131. else if (chat_val.substring(1,6)=="lobby"){
  2132. lobby();
  2133. return "";
  2134. }
  2135. else if (chat_val.substring(1,9)=="debugger"){
  2136. if(Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"] == "none"){
  2137. debuggeropen = true;
  2138. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="block";
  2139. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="none";
  2140. Gdocument.getElementById("ingamechatinputtext").style["display"] = "none";
  2141. }
  2142. else{
  2143. debuggeropen = false;
  2144. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="none";
  2145. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  2146. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";
  2147. }
  2148. return "";
  2149. }
  2150. else if (chat_val.substring(1,6)=="team " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  2151. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  2152. if(text == "r"){Gdocument.getElementById("newbonklobby_redbutton").click();}
  2153. else if(text == "g"){Gdocument.getElementById("newbonklobby_greenbutton").click();}
  2154. else if(text == "y"){Gdocument.getElementById("newbonklobby_yellowbutton").click();}
  2155. else if(text == "b"){Gdocument.getElementById("newbonklobby_bluebutton").click();}
  2156. else if(text == "s"){Gdocument.getElementById("newbonklobby_specbutton").click();}
  2157. else if(text == "f"){Gdocument.getElementById("newbonklobby_ffabutton").click();}
  2158. return "";
  2159. }
  2160. else if (chat_val.substring(1,7)=="notify"){
  2161.  
  2162. npermissions = 1;
  2163. return "";
  2164. }
  2165. else if (chat_val.substring(1,11)=="stopnotify"){
  2166.  
  2167. npermissions = 0;
  2168. return "";
  2169. }
  2170. else if (chat_val.substring(1,5)=="help" || chat_val.substring(1,2)=="?"){
  2171. for(var i = 0;i<help.length;i++){
  2172. displayInChat(help[i],"#DA0808","#1EBCC1");
  2173.  
  2174. }
  2175. return "";
  2176. }
  2177. else if (chat_val.substring(1,9)=="advhelp " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  2178. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  2179. if(typeof(adv_help[text])!='undefined'){
  2180. displayInChat(adv_help[text],"#DA0808","#1EBCC1");
  2181. }
  2182. return "";
  2183. }
  2184. else if(ishost){
  2185.  
  2186. if (chat_val.substring(1,5)=="next" && stopquickplay == 0){
  2187. if(shuffle){
  2188. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2189. var available = [];
  2190. var availableindexes = [];
  2191. var notempty = false;
  2192. for(var i = 0; i<e.length;i++){
  2193. var a = false;
  2194. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2195. available.push(a);
  2196. if(a){
  2197. availableindexes.push(i);
  2198. notempty = true;
  2199. }
  2200. }
  2201. if(notempty){
  2202.  
  2203. if(availableindexes.length!=1){
  2204. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  2205. }
  2206. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  2207. }
  2208. }
  2209. else{
  2210. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2211. var available = [];
  2212. var availableindexes = [];
  2213. var notempty = false;
  2214. for(var i = 0; i<e.length;i++){
  2215. var a = false;
  2216. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2217. available.push(a);
  2218. if(a){
  2219. availableindexes.push(i);
  2220. notempty = true;
  2221. }
  2222. }
  2223. if(notempty){
  2224. var above = [];
  2225. for(var i = 0;i<availableindexes.length;i++){
  2226. if(availableindexes[i]>quicki){
  2227. above.push(availableindexes[i]);
  2228. }
  2229. }
  2230. if(above.length>0){
  2231. quicki = above[0];
  2232. }
  2233. else{
  2234. quicki = availableindexes[0];
  2235. }
  2236. }
  2237. }
  2238. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  2239. displayInChat("Switched to next map.","#DA0808","#1EBCC1");
  2240. return "";
  2241.  
  2242. }
  2243. else if (chat_val.substring(1,9)=="freejoin"){
  2244. if(freejoin == false){
  2245. freejoin = true;
  2246. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  2247.  
  2248. }
  2249. else{
  2250. freejoin = false;
  2251. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  2252. }
  2253.  
  2254. return "";
  2255.  
  2256. }
  2257. else if (chat_val.substring(1,8)=="instaqp"){
  2258. if(instaqp == false){
  2259. instaqp = true;
  2260. displayInChat("Instaqp is now on.","#DA0808","#1EBCC1");
  2261.  
  2262. }
  2263. else{
  2264. instaqp = false;
  2265. displayInChat("Instaqp is now off.","#DA0808","#1EBCC1");
  2266. }
  2267.  
  2268. return "";
  2269.  
  2270. }
  2271.  
  2272. else if (chat_val.substring(1,9)=="previous" && stopquickplay == 0){
  2273. if(shuffle){
  2274. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2275. var available = [];
  2276. var availableindexes = [];
  2277. var notempty = false;
  2278. for(var i = 0; i<e.length;i++){
  2279. var a = false;
  2280. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2281. available.push(a);
  2282. if(a){
  2283. availableindexes.push(i);
  2284. notempty = true;
  2285. }
  2286. }
  2287. if(notempty){
  2288.  
  2289. if(availableindexes.length!=1){
  2290. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  2291. }
  2292. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  2293. }
  2294. }
  2295. else{
  2296. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2297. var available = [];
  2298. var availableindexes = [];
  2299. var notempty = false;
  2300. for(var i = 0; i<e.length;i++){
  2301. var a = false;
  2302. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2303. available.push(a);
  2304. if(a){
  2305. availableindexes.push(i);
  2306. notempty = true;
  2307. }
  2308. }
  2309. if(notempty){
  2310. var above = [];
  2311. for(var i = 0;i<availableindexes.length;i++){
  2312. if(availableindexes[i]<quicki){
  2313. above.push(availableindexes[i]);
  2314. }
  2315. }
  2316. if(above.length>0){
  2317. quicki = above[above.length-1];
  2318. }
  2319. else{
  2320. quicki = availableindexes[availableindexes.length-1];
  2321. }
  2322. }
  2323. }
  2324. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  2325.  
  2326. displayInChat("Switched to previous map.","#DA0808","#1EBCC1");
  2327. return "";
  2328. }
  2329. else if (chat_val.substring(1,6)=="start" && chat_val.length == 6){
  2330. Gdocument.getElementById("newbonklobby_editorbutton").click();
  2331. if(recmodebool && ishost){
  2332. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  2333. if(mode == "" && defaultmode!="d"){
  2334. mode = defaultmode;
  2335. }
  2336. if(mode != ""){
  2337. RECIEVE('42[26,"b","'+mode+'"]');
  2338. }
  2339. }
  2340. Gdocument.getElementById("mapeditor_close").click();
  2341. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  2342. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  2343.  
  2344. return "";
  2345. }
  2346.  
  2347. else if (chat_val.substring(1,8)=="startqp" && stopquickplay == 1){
  2348. stopquickplay = 0;
  2349. quicki = 0;
  2350. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  2351. return "";
  2352. }
  2353. else if (chat_val.substring(1,7)=="stopqp" && stopquickplay == 0){
  2354. stopquickplay = 1;
  2355. quicki = 0;
  2356. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  2357. return "";
  2358. }
  2359.  
  2360. else if (chat_val.substring(1,5)=="ban " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  2361. banned.push(chat_val.substring(5).replace(/^\s+|\s+$/g, ''));
  2362. displayInChat("Banned "+chat_val.substring(5).replace(/^\s+|\s+$/g, '')+".","#DA0808","#1EBCC1");
  2363. return "/kick '" + chat_val.substring(5).replace(/^\s+|\s+$/g, '') + "'";
  2364. }
  2365. else if (chat_val.substring(1,6)=="kill " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  2366. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  2367. var keys = Object.keys(playerids);
  2368. var killid = undefined;
  2369. for(var i = 0; i<keys.length; i++){
  2370. if(playerids[keys[i]] == text){
  2371. killid = keys[i];
  2372. }
  2373. }
  2374. if(typeof(killid)!="undefined" && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  2375. currentFrame = Math.floor((Date.now() - gameStartTimeStamp)/1000*30);
  2376. SEND('42[25,{"a":{"playersLeft":['+killid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  2377. RECIEVE('42[31,{"a":{"playersLeft":['+killid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  2378. }
  2379. return "";
  2380. }
  2381. else if (chat_val.substring(1,10)=="balanceA " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  2382. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  2383. if(!isNaN(parseInt(text))){
  2384. if(parseInt(text)>=-100 && parseInt(text)<=100){
  2385. var keys = Object.keys(playerids);
  2386. for(var i = 0; i<keys.length;i++){
  2387. SEND('42[29,{"sid":'+keys[i]+',"bal":'+text+'}]');
  2388. RECIEVE('42[36,'+keys[i]+','+text+']');
  2389. }
  2390. }
  2391. }
  2392. return "";
  2393.  
  2394. }
  2395. else if (chat_val.substring(1,7)=="moveA " && chat_val.replace(/^\s+|\s+$/g, '').length>=8){
  2396. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  2397. var keys = Object.keys(playerids);
  2398. if(text == "f"){
  2399. for(var i = 0; i<keys.length;i++){
  2400. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":1}]')
  2401. }
  2402. }
  2403. else if(text == "b"){
  2404. for(var i = 0; i<keys.length;i++){
  2405. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":3}]')
  2406. }
  2407. }
  2408. else if(text == "g"){
  2409. for(var i = 0; i<keys.length;i++){
  2410. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":4}]')
  2411. }
  2412. }
  2413. else if(text == "r"){
  2414. for(var i = 0; i<keys.length;i++){
  2415. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":2}]')
  2416. }
  2417. }
  2418. else if(text == "y"){
  2419. for(var i = 0; i<keys.length;i++){
  2420. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":5}]')
  2421. }
  2422. }
  2423. else if(text == "s"){
  2424. for(var i = 0; i<keys.length;i++){
  2425. SEND('42[26,{"targetID":'+keys[i]+',"targetTeam":0}]')
  2426. }
  2427. }
  2428. return "";
  2429. }
  2430. else if (chat_val.substring(1,8)=="rounds " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  2431. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  2432. if(!isNaN(parseInt(text))){
  2433. text = parseInt(text).toString();
  2434. SEND('42[21,{"w":'+text+'}]');
  2435. RECIEVE('42[27,'+text+']');
  2436. }
  2437. return "";
  2438.  
  2439. }
  2440. else if (chat_val.substring(1,6)=="mode " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  2441. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  2442. var mode = "";
  2443. if(text == "arrows"){
  2444. mode = "ar";
  2445. displayInChat("Changed mode to arrows.","#DA0808","#1EBCC1");
  2446. }
  2447. else if(text == "death arrows"){
  2448. mode = "ard";
  2449. displayInChat("Changed mode to death arrows.","#DA0808","#1EBCC1");
  2450. }
  2451. else if(text == "grapple"){
  2452. mode = "sp";
  2453. displayInChat("Changed mode to grapple.","#DA0808","#1EBCC1");
  2454. }
  2455. else if(text == "classic"){
  2456. mode = "b";
  2457. displayInChat("Changed mode to classic.","#DA0808","#1EBCC1");
  2458.  
  2459. }
  2460. else{
  2461. displayInChat("Mode options:","#DA0808","#1EBCC1");
  2462. displayInChat("classic","#DA0808","#1EBCC1");
  2463. displayInChat("arrows","#DA0808","#1EBCC1");
  2464. displayInChat("death arrows","#DA0808","#1EBCC1");
  2465. displayInChat("grapple","#DA0808","#1EBCC1");
  2466. }
  2467. if(mode != ""){
  2468. SEND('42[20,{"ga":"b","mo":"'+mode+'"}]');
  2469. RECIEVE('42[26,"b","'+mode+'"]');
  2470. }
  2471. return "";
  2472.  
  2473. }
  2474. else if (chat_val.substring(1,13)=="defaultmode " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  2475. var text = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  2476. if(text == "default"){
  2477. defaultmode = "";
  2478. displayInChat("Changed default mode to default.","#DA0808","#1EBCC1");
  2479. }
  2480. else if(text == "arrows"){
  2481. defaultmode = "ar";
  2482. displayInChat("Changed default mode to arrows.","#DA0808","#1EBCC1");
  2483. }
  2484. else if(text == "death arrows"){
  2485. defaultmode = "ard";
  2486. displayInChat("Changed default mode to death arrows.","#DA0808","#1EBCC1");
  2487. }
  2488. else if(text == "grapple"){
  2489. defaultmode = "sp";
  2490. displayInChat("Changed default mode to grapple.","#DA0808","#1EBCC1");
  2491. }
  2492. else if(text == "classic"){
  2493. defaultmode = "b";
  2494. displayInChat("Changed default mode to classic.","#DA0808","#1EBCC1");
  2495.  
  2496. }
  2497. else{
  2498. displayInChat("Default mode options:","#DA0808","#1EBCC1");
  2499. displayInChat("default","#DA0808","#1EBCC1");
  2500. displayInChat("classic","#DA0808","#1EBCC1");
  2501. displayInChat("arrows","#DA0808","#1EBCC1");
  2502. displayInChat("death arrows","#DA0808","#1EBCC1");
  2503. displayInChat("grapple","#DA0808","#1EBCC1");
  2504. }
  2505. return "";
  2506.  
  2507. }
  2508. else if (chat_val.substring(1,8)=="recmode"){
  2509. if(recmodebool == true){
  2510. recmodebool = false;
  2511. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  2512.  
  2513. }
  2514. else{
  2515. recmodebool = true;
  2516. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  2517.  
  2518. }
  2519.  
  2520. return "";
  2521.  
  2522. }
  2523. else if (chat_val.substring(1,8)=="shuffle"){
  2524. if(shuffle == true){
  2525. shuffle = false;
  2526. displayInChat("Shuffle is now off.","#DA0808","#1EBCC1");
  2527.  
  2528. }
  2529. else{
  2530. shuffle = true;
  2531. displayInChat("Shuffle is now on.","#DA0808","#1EBCC1");
  2532.  
  2533. }
  2534.  
  2535. return "";
  2536.  
  2537. }
  2538. else if(sandboxon){
  2539. if (chat_val.substring(1,11)=="addplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  2540. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  2541. if(!isNaN(parseInt(text))){
  2542. var text2 = parseInt(text);
  2543. if(text2>0){
  2544. for(var i = 0;i<text2;i++){
  2545. RECIEVE('42[4,'+sandboxid+',"0123456789abcdef","'+sandboxid.toString()+'",true,0,1,{"layers":[],"bc":'+Math.floor(Math.random() * 16777215).toString()+'}]');
  2546. sandboxplayerids[sandboxid] = sandboxid.toString();
  2547. sandboxid+=1;
  2548. }
  2549.  
  2550. }
  2551. }
  2552. return "";
  2553.  
  2554. }
  2555. else if (chat_val.substring(1,11)=="delplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  2556. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  2557. if(!isNaN(parseInt(text))){
  2558. var text2 = parseInt(text);
  2559. if(text2>0){
  2560. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden"){
  2561. var jsonkeys = Object.keys(sandboxplayerids).reverse();
  2562. for(var i = 0;i<text2 && i<jsonkeys.length;i++){
  2563. RECIEVE('42[5,'+jsonkeys[i]+',0]');
  2564. delete sandboxplayerids[jsonkeys[i]];
  2565. }
  2566. }
  2567. else{
  2568. displayInChat("Cannot delete players while ingame.","#DA0808","#1EBCC1");
  2569. }
  2570.  
  2571. }
  2572. }
  2573. return "";
  2574. }
  2575. else if (chat_val.substring(1,7)=="copyme"){
  2576. if(sandboxcopyme == true){
  2577. displayInChat("Copyme is now off.","#DA0808","#1EBCC1");
  2578. sandboxcopyme = false;
  2579. }
  2580. else{
  2581. displayInChat("Copyme is now on.","#DA0808","#1EBCC1");
  2582. sandboxcopyme = true;
  2583. }
  2584.  
  2585. return "";
  2586. }
  2587. }
  2588. }
  2589. return chat_val;
  2590. };
  2591.  
  2592. scope.flag_manage = function(t){
  2593. var text = t;
  2594.  
  2595. if(rcaps_flag == true){
  2596. text = text.split('');
  2597. for(var i = 0; i<text.length;i++){
  2598. if(Math.floor(Math.random()*2)){
  2599. text[i] = text[i].toUpperCase();
  2600. }
  2601. else{
  2602. text[i] = text[i].toLowerCase();
  2603. }
  2604. }
  2605. text = text.join('');
  2606. }
  2607. if(space_flag == true){
  2608. text = text.split('').join(' ')
  2609. }
  2610. if(number_flag == true){
  2611. text = text.replace(/[t|T][Oo]+/g,"2");
  2612. text = text.replace(/[f|F][o|O][r|R]/g,"4");
  2613. text = text.replace(/[a|A][t|T][e|E]/g,"8");
  2614. text = text.replace(/[e|E]/g,"3");
  2615. text = text.replace(/[a|A]/g,"4");
  2616. text = text.replace(/[o|O]/g,"0");
  2617. text = text.replace(/[s|S]/g,"5");
  2618. text = text.replace(/[i|I|l|L]/g,"1");
  2619. }
  2620. return text;
  2621. };
  2622. Gdocument.getElementById("newbonklobby_chat_input").onkeydown = function(e){
  2623. if(e.keyCode==13){
  2624.  
  2625. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  2626.  
  2627. if (chat_val!="" && chat_val[0]=="/"){
  2628.  
  2629. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  2630. chat(commandhandle(chat_val));
  2631. }
  2632. else{
  2633. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  2634. chat(flag_manage(chat_val));
  2635. }
  2636.  
  2637. }
  2638. };
  2639. Gdocument.getElementById("ingamechatinputtext").onkeydown = function(e){
  2640. if(e.keyCode==13){
  2641.  
  2642. var chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  2643.  
  2644. if (chat_val!="" && chat_val[0]=="/"){
  2645.  
  2646. Gdocument.getElementById("ingamechatinputtext").value = "";
  2647. chat(commandhandle(chat_val));
  2648. }
  2649. else{
  2650. Gdocument.getElementById("ingamechatinputtext").value = "";
  2651. chat(flag_manage(chat_val));
  2652. }
  2653. }
  2654. };
  2655. scope.Last_message = "";
  2656. scope.Laster_message = "";
  2657. scope.new_message = false;
  2658. scope.changed_chat = false;
  2659. scope.interval = setInterval(timeout123,60);
  2660.  
  2661. scope.hotkeys = function(e){
  2662. if(e.repeat){return;}
  2663. var keycode = e.code;
  2664. if(e.altKey && !e.shiftKey && !e.ctrlKey && !e.metaKey){
  2665. if(ishost){
  2666. if(keycode == "KeyE"){
  2667. if(Gdocument.getElementById("newbonklobby").style["display"] == "block"){
  2668. Gdocument.getElementById("newbonklobby_editorbutton").click();
  2669. }
  2670. else if(Gdocument.getElementById("mapeditorcontainer").style["display"] == "block"){
  2671. Gdocument.getElementById("mapeditor_close").click();
  2672. }
  2673. e.preventDefault();
  2674.  
  2675. }
  2676. else if(keycode == "KeyT"){
  2677. Gdocument.getElementById("newbonklobby_teamsbutton").click();
  2678. e.preventDefault();
  2679. }
  2680. else if(keycode == "KeyM"){
  2681. Gdocument.getElementById("newbonklobby_modebutton").click();
  2682. e.preventDefault();
  2683. }
  2684. else if(keycode == "KeyK"){
  2685. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  2686. Gdocument.getElementById("pretty_top_exit").click();
  2687. }
  2688. e.preventDefault();
  2689. }
  2690. else if(keycode == "KeyS"){
  2691. Gdocument.getElementById("newbonklobby_editorbutton").click();
  2692. if(recmodebool && ishost){
  2693. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  2694. if(mode == "" && defaultmode!="d"){
  2695. mode = defaultmode;
  2696. }
  2697. if(mode != ""){
  2698. RECIEVE('42[26,"b","'+mode+'"]');
  2699. }
  2700. }
  2701. Gdocument.getElementById("mapeditor_close").click();
  2702. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  2703. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  2704. e.preventDefault();
  2705. }
  2706. else if(keycode == "KeyD"){
  2707. if(stopquickplay == 0){
  2708. if(shuffle){
  2709. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2710. var available = [];
  2711. var availableindexes = [];
  2712. var notempty = false;
  2713. for(var i = 0; i<e2.length;i++){
  2714. var a = false;
  2715. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2716. available.push(a);
  2717. if(a){
  2718. availableindexes.push(i);
  2719. notempty = true;
  2720. }
  2721. }
  2722. if(notempty){
  2723.  
  2724. if(availableindexes.length!=1){
  2725. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  2726. }
  2727. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  2728. }
  2729. }
  2730. else{
  2731. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2732. var available = [];
  2733. var availableindexes = [];
  2734. var notempty = false;
  2735. for(var i = 0; i<e2.length;i++){
  2736. var a = false;
  2737. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2738. available.push(a);
  2739. if(a){
  2740. availableindexes.push(i);
  2741. notempty = true;
  2742. }
  2743. }
  2744. if(notempty){
  2745. var above = [];
  2746. for(var i = 0;i<availableindexes.length;i++){
  2747. if(availableindexes[i]>quicki){
  2748. above.push(availableindexes[i]);
  2749. }
  2750. }
  2751. if(above.length>0){
  2752. quicki = above[0];
  2753. }
  2754. else{
  2755. quicki = availableindexes[0];
  2756. }
  2757. }
  2758. }
  2759. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  2760. }
  2761. e.preventDefault();
  2762. }
  2763. else if(keycode == "KeyA"){
  2764. if(stopquickplay == 0){
  2765. if(shuffle){
  2766. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2767. var available = [];
  2768. var availableindexes = [];
  2769. var notempty = false;
  2770. for(var i = 0; i<e2.length;i++){
  2771. var a = false;
  2772. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2773. available.push(a);
  2774. if(a){
  2775. availableindexes.push(i);
  2776. notempty = true;
  2777. }
  2778. }
  2779. if(notempty){
  2780.  
  2781. if(availableindexes.length!=1){
  2782. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  2783. }
  2784. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  2785. }
  2786. }
  2787. else{
  2788. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2789. var available = [];
  2790. var availableindexes = [];
  2791. var notempty = false;
  2792. for(var i = 0; i<e2.length;i++){
  2793. var a = false;
  2794. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2795. available.push(a);
  2796. if(a){
  2797. availableindexes.push(i);
  2798. notempty = true;
  2799. }
  2800. }
  2801. if(notempty){
  2802. var above = [];
  2803. for(var i = 0;i<availableindexes.length;i++){
  2804. if(availableindexes[i]<quicki){
  2805. above.push(availableindexes[i]);
  2806. }
  2807. }
  2808. if(above.length>0){
  2809. quicki = above[above.length-1];
  2810. }
  2811. else{
  2812. quicki = availableindexes[availableindexes.length-1];
  2813. }
  2814. }
  2815. }
  2816. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  2817. }
  2818. e.preventDefault();
  2819. }
  2820. else if(keycode == "KeyQ"){
  2821. if(stopquickplay == 1){
  2822. stopquickplay = 0;
  2823. quicki = 0;
  2824. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  2825. }
  2826. else{
  2827. stopquickplay = 1;
  2828. quicki = 0;
  2829. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  2830. }
  2831. e.preventDefault();
  2832. }
  2833. else if(keycode == "KeyR"){
  2834. if(recmodebool == true){
  2835. recmodebool = false;
  2836. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  2837.  
  2838. }
  2839. else{
  2840. recmodebool = true;
  2841. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  2842.  
  2843. }
  2844. }
  2845. else if(keycode == "KeyF"){
  2846. if(freejoin == false){
  2847. freejoin = true;
  2848. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  2849.  
  2850. }
  2851. else{
  2852. freejoin = false;
  2853. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  2854. }
  2855. e.preventDefault();
  2856. }
  2857. }
  2858. else{
  2859. if(keycode == "KeyE"){
  2860. e.preventDefault();
  2861. }
  2862. else if(keycode == "KeyT"){
  2863. e.preventDefault();
  2864. }
  2865. else if(keycode == "KeyM"){
  2866. e.preventDefault();
  2867. }
  2868. else if(keycode == "KeyK"){
  2869. e.preventDefault();
  2870. }
  2871. else if(keycode == "KeyS"){
  2872. e.preventDefault();
  2873. }
  2874. else if(keycode == "KeyD"){
  2875. e.preventDefault();
  2876. }
  2877. else if(keycode == "KeyA"){
  2878. e.preventDefault();
  2879. }
  2880. else if(keycode == "KeyQ"){
  2881. e.preventDefault();
  2882. }
  2883. else if(keycode == "KeyF"){
  2884. e.preventDefault();
  2885. }
  2886. else if(keycode == "KeyR"){
  2887. e.preventDefault();
  2888. }
  2889.  
  2890. }
  2891. if(keycode == "KeyL"){
  2892. lobby();
  2893. e.preventDefault();
  2894. }
  2895. if(keycode == "KeyC"){
  2896. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  2897. if(Gdocument.getElementById("ingamechatcontent").style["max-height"]=="0px"){
  2898. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  2899. }
  2900. else{
  2901. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  2902. }
  2903. }
  2904. e.preventDefault();
  2905. }
  2906. if(keycode == "KeyI"){
  2907. if(Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"] == "none"){
  2908. debuggeropen = true;
  2909. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="block";
  2910. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="none";
  2911. Gdocument.getElementById("ingamechatinputtext").style["display"] = "none";
  2912. }
  2913. else{
  2914. debuggeropen = false;
  2915. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="none";
  2916. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  2917. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";
  2918. }
  2919. e.preventDefault();
  2920. }
  2921. }
  2922. if(!e.altKey && !e.shiftKey && !e.ctrlKey && !e.metaKey){
  2923. if(keycode == "Slash"){
  2924. if(Gdocument.getElementById("newbonklobby").style["display"]=="block" && Gdocument.getElementById("newbonklobby_chat_input").value == "" && Gdocument.getElementById("maploadwindowcontainer").style["display"]!="block" && Gdocument.getElementById("newbonklobby_chat_input").style["display"]==""){
  2925. Gdocument.getElementById("newbonklobby_chat_input").value = "/";
  2926. if(Gdocument.getElementById("newbonklobby_chat_input").style["pointer-events"] == "none"){
  2927. fire("keydown",{keyCode:13});
  2928. }
  2929. else{
  2930. Gdocument.getElementById("newbonklobby_chat_input").focus();
  2931. }
  2932. e.preventDefault();
  2933.  
  2934. }
  2935. else if(Gdocument.getElementById("ingamechatinputtext").style["visibility"]=="visible" && Gdocument.getElementById("ingamechatinputtext").style["display"]=="" && Gdocument.getElementById("mapeditorcontainer").style["display"]!="block" && Gdocument.getElementById("ingamechatinputtext").value == ""){
  2936. Gdocument.getElementById("ingamechatinputtext").value = "/";
  2937. if(!Gdocument.getElementById("ingamechatinputtext").classList.value.includes("ingamechatinputtextbg")){
  2938. fire("keydown",{keyCode:13});
  2939. }
  2940. else{
  2941. Gdocument.getElementById("ingamechatinputtext").focus();
  2942. }
  2943. e.preventDefault();
  2944.  
  2945. }
  2946. }
  2947. }
  2948. };
  2949.  
  2950. Gdocument.onkeydown = hotkeys;
  2951.  
  2952. Gwindow.addEventListener('resize',function(e){
  2953. debuggermenu.style["width"] = Gdocument.getElementById("bonkiocontainer").style["width"];
  2954. debuggermenu.style["height"] = Gdocument.getElementById("bonkiocontainer").style["height"];
  2955. scope.width = parseInt(Gdocument.getElementById("bonkiocontainer").style["width"])-20;
  2956. scope.height = parseInt(Gdocument.getElementById("bonkiocontainer").style["height"])-210;
  2957. logmenu.style["width"] = width.toString()+"px";
  2958. logmenu.style["height"] = height.toString()+"px";
  2959. logmenutopleft.style["width"] = (width/2).toString()+"px";
  2960. logmenutopright.style["width"] = (width/2).toString()+"px";
  2961. logmenutopright.style["left"] = (width/2).toString()+"px";
  2962. debuggerinput.style["width"] = width.toString()+"px";
  2963. debuggerinput.style["top"] = (height+90).toString()+"px";
  2964. debuggersendrecieve.style["top"] = (height+120).toString()+"px";
  2965. debuggerpausebutton.style["top"] = (height+150).toString()+"px";
  2966. debuggereval.style["width"] = (width-150).toString()+"px";
  2967. debuggereval.style["top"] = (height+120).toString()+"px";},true);
  2968.  
  2969.  
  2970. function timeout123() {
  2971. updateWssLog();
  2972. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  2973. clearmaprequests.style["display"] = "block";
  2974. refreshmaprequests.style["display"] = "block";
  2975. }
  2976. else{
  2977. clearmaprequests.style["display"] = "none";
  2978. refreshmaprequests.style["display"] = "none";
  2979. }
  2980. if(Gdocument.getElementById("gamerenderer").style["visibility"]=="hidden"){
  2981. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  2982. }
  2983. if(Gdocument.getElementById("maploadwindowmapscontainer").children.length>0 && maponclick == 0){
  2984. maponclick = Gdocument.getElementById("maploadwindowmapscontainer").children[0].onclick;
  2985. }
  2986. if(Gdocument.getElementById("sm_connectingContainer").style["visibility"] == "hidden"){
  2987. var chatbox = Gdocument.getElementById("newbonklobby_chat_content");
  2988. while (chatbox.firstChild) {
  2989. chatbox.removeChild(chatbox.firstChild);
  2990. }
  2991. rcaps_flag = false;
  2992. space_flag = false;
  2993. number_flag = false;
  2994. echo_list = [];
  2995. scroll = false;
  2996. stopquickplay = 1;
  2997. checkboxhidden = false;
  2998. freejoin = false;
  2999. shuffle = false;
  3000. defaultmode = "";
  3001. recmodebool = false;
  3002. playerids = {};
  3003. ishost = false;
  3004. sandboxplayerids = {};
  3005. sandboxcopyme = false;
  3006. sandboxon = false;
  3007. sandboxid = 1;
  3008. if(chatlog[chatlog.length-1]!="ROOM END"){
  3009. chatlog.push("ROOM END");
  3010. }
  3011. }
  3012. else{
  3013. if(chatlog[chatlog.length-1]=="ROOM END"){
  3014. chatlog.push("ROOM START");
  3015. }
  3016. }
  3017.  
  3018. if(Gdocument.getElementById("newbonklobby").style["display"]=="block"){
  3019. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="hidden";
  3020. }
  3021. else{
  3022. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="visible";
  3023.  
  3024. }
  3025. mode = Gdocument.getElementById("newbonklobby_modetext").textContent;
  3026. var userlist = Gdocument.getElementsByClassName("newbonklobby_playerentry_name");
  3027. users = [];
  3028. for(var i = 0;i<userlist.length;i++){
  3029. users.push(userlist[i].textContent);
  3030. }
  3031. if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 0){
  3032. ishost = true;
  3033. }
  3034. else{
  3035. ishost = false;
  3036. }
  3037.  
  3038. if(Gdocument.getElementById("pretty_top_name")!=null){
  3039. username = Gdocument.getElementById("pretty_top_name").textContent;
  3040. }
  3041. try{
  3042. Last_message = lastmessage()
  3043. } catch{
  3044. Last_message = "";
  3045. }
  3046. if (Laster_message != Last_message){
  3047. Laster_message = Last_message;
  3048. if(changed_chat==false){
  3049. new_message = true;
  3050. }
  3051. else{
  3052. changed_chat = false;
  3053. }
  3054. }
  3055. if(new_message){
  3056. chatlog.push(Last_message);
  3057. if(freejoin && Last_message.startsWith("* ") && Last_message.endsWith(" has joined the game") && ishost){
  3058.  
  3059. var userjoined = Last_message.substring(2,Last_message.length-20);
  3060.  
  3061. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  3062. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  3063. Gdocument.getElementById("ingamechatinputtext").value = "";
  3064. Gdocument.getElementById("newbonklobby_editorbutton").click();
  3065. Gdocument.getElementById("mapeditor_close").click();
  3066. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  3067. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  3068.  
  3069. }
  3070. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry newbonklobby_playerentry_half");
  3071. var inplaying = false;
  3072. for(var i = 0;i<playing.length;i++){
  3073. if(userjoined == playing[i].children[1].textContent){
  3074. inplaying = true;
  3075. break;
  3076. }
  3077. }
  3078.  
  3079. if(playing.length<=2 && inplaying){
  3080. Gdocument.getElementById("newbonklobby_editorbutton").click();
  3081. Gdocument.getElementById("mapeditor_close").click();
  3082. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  3083. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  3084. if(transitioning == true){
  3085. canceled = true;
  3086. }
  3087. }
  3088.  
  3089. }
  3090. var lm = "";
  3091. try{
  3092. lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  3093. if(typeof(lm[0].parentElement.style["parsed"]) == 'undefined'){
  3094. if (lm[0].className == "newbonklobby_chat_msg_colorbox"){
  3095. lm[2].innerHTML = urlify(lm[2].innerHTML);
  3096. Laster_message = lastmessage();
  3097. lm[0].parentElement.style["parsed"] = true;
  3098. }
  3099. if (lm[0].className == "newbonklobby_chat_status"){
  3100. lm[0].innerHTML = urlify(lm[0].innerHTML);
  3101. Laster_message = lastmessage();
  3102. lm[0].parentElement.style["parsed"] = true;
  3103. }
  3104. }
  3105. }
  3106. catch{
  3107. lm = "";
  3108. }
  3109.  
  3110. if(Last_message.indexOf("@"+username)!=-1 && npermissions == 1){
  3111. if(Notification.requestPermission()){
  3112. var n = new Notification(Last_message);
  3113. }
  3114. }
  3115.  
  3116. try{
  3117. lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  3118. if(typeof(lm[0].parentElement.style["parsed"])=='undefined'){
  3119. if(lm[0].className == "ingamechatname"){
  3120. lm[1].innerHTML = urlify(lm[1].innerHTML);
  3121. Laster_message = lastmessage();
  3122. lm[0].parentElement.style["parsed"] = true;
  3123. }
  3124. if(lm[0].className == ""){
  3125. lm[0].innerHTML = urlify(lm[0].innerHTML);
  3126. Laster_message = lastmessage();
  3127. lm[0].parentElement.style["parsed"] = true;
  3128. }
  3129. }
  3130. }
  3131. catch{
  3132. lm = "";
  3133. }
  3134. for(i=0;i<echo_list.length;i++){
  3135. if(Last_message.substring(0,echo_list[i].length+2) == echo_list[i]+": "){
  3136. message = Last_message.substring(echo_list[i].length+2);
  3137. chat(flag_manage(message+" "+echoAppend));
  3138. }
  3139. }
  3140. if(text2speech){
  3141. if(!sayer.speaking){
  3142. if(Last_message.includes(": ")){
  3143. speech.text = Last_message.substring(0,Last_message.indexOf(":")).toLowerCase();
  3144. speech.rate = 2.25;
  3145. sayer.speak(speech);
  3146. speech.text = Last_message.substring(Last_message.indexOf(": ")+3).toLowerCase();
  3147. speech.rate = 1.25;
  3148. sayer.speak(speech);
  3149. }
  3150. else{
  3151. speech.text = Last_message.toLowerCase();
  3152. sayer.speak(speech);
  3153. }
  3154. }
  3155. }
  3156. }
  3157. if (ishost==true && new_message){
  3158. for(i=0;i<banned.length;i++){
  3159. if(Last_message.startsWith("* "+banned[i]+" has joined the game")){
  3160. chat("/kick '"+banned[i]+"'");
  3161. }
  3162. }
  3163. }
  3164. if(ishost && stopquickplay == 0){
  3165. if(checkboxhidden){
  3166. checkboxhidden = false;
  3167. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  3168. for(var i = 0; i<classes.length;i++){
  3169. classes[i].style["display"] = "block";
  3170. classes[i].className = "quickplaycheckbox quickplaychecked";
  3171. }
  3172. Gdocument.getElementById('clearallcheckboxes').style["display"] = "block";
  3173.  
  3174. }
  3175. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && stopquickplay == 0 && dontswitch == false && !document.hidden){
  3176. if(shuffle){
  3177. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  3178. var available = [];
  3179. var availableindexes = [];
  3180. var notempty = false;
  3181. for(var i = 0; i<e.length;i++){
  3182. var a = false;
  3183. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  3184. available.push(a);
  3185. if(a){
  3186. availableindexes.push(i);
  3187. notempty = true;
  3188. }
  3189. }
  3190. if(notempty){
  3191. if(availableindexes.length!=1){
  3192. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  3193. }
  3194. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  3195. }
  3196. }
  3197. else{
  3198. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  3199. var available = [];
  3200. var availableindexes = [];
  3201. var notempty = false;
  3202. for(var i = 0; i<e.length;i++){
  3203. var a = false;
  3204. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  3205. available.push(a);
  3206. if(a){
  3207. availableindexes.push(i);
  3208. notempty = true;
  3209. }
  3210. }
  3211. if(notempty){
  3212. var above = [];
  3213. for(var i = 0;i<availableindexes.length;i++){
  3214. if(availableindexes[i]>quicki){
  3215. above.push(availableindexes[i]);
  3216. }
  3217. }
  3218. if(above.length>0){
  3219. quicki = above[0];
  3220. }
  3221. else{
  3222. quicki = availableindexes[0];
  3223. }
  3224. }
  3225. }
  3226. transitioning = true;
  3227. startedinqp = true;
  3228. map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  3229. dontswitch = true;
  3230. setTimeout(function(){Gdocument.getElementById("ingamewinner").style["visibility"]="hidden"; dontswitch = false;},timedelay);
  3231. }
  3232. }
  3233. else{
  3234. if(!checkboxhidden){
  3235. checkboxhidden = true;
  3236. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  3237. for(var i = 0; i<classes.length;i++){
  3238. classes[i].style["display"] = "none";
  3239. classes[i].className = "quickplaycheckbox quickplayunchecked";
  3240. }
  3241. Gdocument.getElementById('clearallcheckboxes').style["display"] = "none";
  3242. }
  3243. }
  3244. new_message = false;
  3245. };
  3246. });

QingJ © 2025

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