Bonk Commands

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

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

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

QingJ © 2025

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