Bonk Commands

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

当前为 2023-06-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk Commands
  3. // @namespace https://gf.qytechs.cn/en/scripts/451341-bonk-commands
  4. // @version 16.3
  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. scope.scope = scope;
  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. clearInterval(injectedBonkCommandsScript);
  35. }
  36. scope.GENERATE_COPRIME_NUMBER = function(mini = 0,maxi = 0,coprimewith = 0,choices = []){
  37. if(choices.length == 0){
  38. for(var i = mini;i<maxi+1;i++){
  39. choices.push(i);
  40. }
  41. }
  42. firstTry = choices[Math.floor(Math.random()*choices.length)];
  43. for(var i = 2; i<firstTry+1;i++){
  44. if(firstTry%i == 0 && coprimewith%i == 0){
  45. choices.splice(choices.indexOf(firstTry),1);
  46. if(choices.length == 0){
  47. return 0;
  48. }
  49. return GENERATE_COPRIME_NUMBER(mini,maxi,coprimewith,choices);
  50. }
  51. }
  52. return firstTry;
  53. };
  54. scope.GENERATE_PRIME_NUMBER = function(mini = 0,maxi = 0,choices = []){
  55. if(choices.length == 0){
  56. for(var i = mini;i<maxi+1;i++){
  57. choices.push(i);
  58. }
  59. }
  60. firstTry = choices[Math.floor(Math.random()*choices.length)];
  61. for(var i = 2; i<Math.floor(Math.sqrt(firstTry)+1);i++){
  62. if(i!=firstTry){
  63. if(firstTry%i == 0){
  64. choices.splice(choices.indexOf(firstTry),1);
  65. if(choices.length == 0){
  66. return 0;
  67. }
  68. return GENERATE_PRIME_NUMBER(mini,maxi,choices);
  69. }
  70. }
  71. }
  72. return firstTry;
  73. };
  74. scope.SHUFFLE_LIST = function(x){
  75. var nl = x.slice();
  76. for(var i = nl.length - 1;i>0;i--){
  77. var r = Math.floor(Math.random()*(i+1));
  78. var t = nl[i];
  79. nl[i] = nl[r];
  80. nl[r] = t;
  81. }
  82. return nl;
  83. };
  84. scope.GENERATE_KEYS = function(){
  85. interval = [];
  86. for(var i = 100;i<301;i++){
  87. interval.push(i);
  88. }
  89. random_prime = [GENERATE_PRIME_NUMBER(0,0,choices = interval),0];
  90. interval.splice(interval.indexOf(random_prime[0]),1);
  91. random_prime[1] = GENERATE_PRIME_NUMBER(0,0,choices = interval);
  92.  
  93. n = random_prime[0]*random_prime[1];
  94. n2 = (random_prime[0]-1)*(random_prime[1]-1);
  95.  
  96. e = GENERATE_COPRIME_NUMBER(2,n2-1,n2);
  97. d = 0;
  98. redo = true;
  99. for(var i = 0;i<1000000;i++){
  100. if((e*i-1)%n2 == 0 && i!=e){
  101. d = i;
  102. redo = false;
  103. break;
  104. }
  105. }
  106. if(redo){
  107. return GENERATE_KEYS();
  108. }
  109. else{
  110. return [[n,e],[n,d]];
  111. }
  112.  
  113. };
  114. scope.CRYPT_NUMBER = function(key, data){
  115.  
  116. result = 1;
  117.  
  118. for(var i = 0;i<key[1];i++){
  119. result*=data;
  120. result = result%key[0];
  121. }
  122. return result%key[0];
  123.  
  124. };
  125.  
  126. scope.CRYPT_MESSAGE = function(key,data){
  127. var resulttext = [];
  128. for(var i = 0;i<data.length;i++){
  129. resulttext.push(CRYPT_NUMBER(key,data[i]));
  130. }
  131. return resulttext;
  132.  
  133. };
  134. if(typeof(scope.textdecoder)=='undefined'){scope.textdecoder = new Gwindow.TextDecoder;}
  135. if(typeof(scope.textencoder)=='undefined'){scope.textencoder = new Gwindow.TextEncoder;}
  136.  
  137. class bytebuffer2 {
  138. constructor() {
  139. var g1d = [arguments];
  140. this.index = 0;
  141. this.buffer = new ArrayBuffer(100*1024);
  142. this.view = new DataView(this.buffer);
  143. this.implicitClassAliasArray = [];
  144. this.implicitStringArray = [];
  145. this.bodgeCaptureZoneDataIdentifierArray = [];
  146. }
  147. readByte() {
  148. var N0H = [arguments];
  149. N0H[4] = this.view.getUint8(this.index);
  150. this.index += 1;
  151. return N0H[4];
  152. }
  153. writeByte(z0w) {
  154. var v8$ = [arguments];
  155. this.view.setUint8(this.index, v8$[0][0]);
  156. this.index += 1;
  157. }
  158. readInt() {
  159. var A71 = [arguments];
  160. A71[6] = this.view.getInt32(this.index);
  161. this.index += 4;
  162. return A71[6];
  163. }
  164. writeInt(W6i) {
  165. var p5u = [arguments];
  166. this.view.setInt32(this.index, p5u[0][0]);
  167. this.index += 4;
  168. }
  169. readShort() {
  170. var R1R = [arguments];
  171. R1R[9] = this.view.getInt16(this.index);
  172. this.index += 2;
  173. return R1R[9];
  174. }
  175. writeShort(H8B) {
  176. var d_3 = [arguments];
  177. this.view.setInt16(this.index, d_3[0][0]);
  178. this.index += 2;
  179. }
  180. readUint() {
  181. var W2$ = [arguments];
  182. W2$[8] = this.view.getUint32(this.index);
  183. this.index += 4;
  184. return W2$[8];
  185. }
  186. writeUint(B2X) {
  187. var f8B = [arguments];
  188. this.view.setUint32(this.index, f8B[0][0]);
  189. this.index += 4;
  190. }
  191. readBoolean() {
  192. var h6P = [arguments];
  193. h6P[6] = this.readByte();
  194. return h6P[6] == 1;
  195. }
  196. writeBoolean(Y3I) {
  197. var l79 = [arguments];
  198. if (l79[0][0]) {
  199. this.writeByte(1);
  200. } else {
  201. this.writeByte(0);
  202. }
  203. }
  204. readDouble() {
  205. var V60 = [arguments];
  206. V60[4] = this.view.getFloat64(this.index);
  207. this.index += 8;
  208. return V60[4];
  209. }
  210. writeDouble(z4Z) {
  211. var O41 = [arguments];
  212. this.view.setFloat64(this.index, O41[0][0]);
  213. this.index += 8;
  214. }
  215. readFloat() {
  216. var I0l = [arguments];
  217. I0l[5] = this.view.getFloat32(this.index);
  218. this.index += 4;
  219. return I0l[5];
  220. }
  221. writeFloat(y4B) {
  222. var B0v = [arguments];
  223. this.view.setFloat32(this.index, B0v[0][0]);
  224. this.index += 4;
  225. }
  226. readUTF() {
  227. var d6I = [arguments];
  228. d6I[8] = this.readByte();
  229. d6I[7] = this.readByte();
  230. d6I[9] = d6I[8] * 256 + d6I[7];
  231. d6I[1] = new Uint8Array(d6I[9]);
  232. for (d6I[6] = 0; d6I[6] < d6I[9]; d6I[6]++) {
  233. d6I[1][d6I[6]] = this.readByte();
  234. }
  235. return textdecoder.decode(d6I[1]);
  236. }
  237. writeUTF(L3Z) {
  238. var Z75 = [arguments];
  239. Z75[4] = textencoder.encode(Z75[0][0]);
  240. Z75[3] = Z75[4].length;
  241. Z75[5] = Math.floor(Z75[3]/256);
  242. Z75[8] = Z75[3] % 256;
  243. this.writeByte(Z75[5]);
  244. this.writeByte(Z75[8]);
  245. Z75[7] = this;
  246. Z75[4].forEach(I_O);
  247. function I_O(s0Q, H4K, j$o) {
  248. var N0o = [arguments];
  249. Z75[7].writeByte(N0o[0][0]);
  250. }
  251. }
  252. toBase64() {
  253. var P4$ = [arguments];
  254. P4$[4] = "";
  255. P4$[9] = new Uint8Array(this.buffer);
  256. P4$[8] = this.index;
  257. for (P4$[7] = 0; P4$[7] < P4$[8]; P4$[7]++) {
  258. P4$[4] += String.fromCharCode(P4$[9][P4$[7]]);
  259. }
  260. return Gwindow.btoa(P4$[4]);
  261. }
  262. fromBase64(W69, A8Q) {
  263. var o0n = [arguments];
  264. o0n[8] = Gwindow.pako;
  265. o0n[6] = Gwindow.atob(o0n[0][0]);
  266. o0n[9] = o0n[6].length;
  267. o0n[4] = new Uint8Array(o0n[9]);
  268. for (o0n[1] = 0; o0n[1] < o0n[9]; o0n[1]++) {
  269. o0n[4][o0n[1]] = o0n[6].charCodeAt(o0n[1]);
  270. }
  271. if (o0n[0][1] === true) {
  272. o0n[5] = o0n[8].inflate(o0n[4]);
  273. o0n[4] = o0n[5];
  274. }
  275. this.buffer = o0n[4].buffer.slice(
  276. o0n[4].byteOffset,
  277. o0n[4].byteLength + o0n[4].byteOffset
  278. );
  279. this.view = new DataView(this.buffer);
  280. this.index = 0;
  281. }
  282. };
  283.  
  284. if(typeof(scope.originalSend)=='undefined'){scope.originalSend = Gwindow.WebSocket.prototype.send;}
  285. if(typeof(scope.originalDatenow)=='undefined'){scope.originalDatenow = Gwindow.Date.now;}
  286.  
  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 = 0;}
  290. if(typeof(scope.originalDrawCircle)=='undefined'){scope.originalDrawCircle = Gwindow.PIXI.Graphics.prototype.drawCircle;}
  291. if(typeof(scope.parentDraw)=='undefined'){scope.parentDraw = 0;}
  292. if(typeof(scope.pixiCircle)=='undefined'){scope.pixiCircle = new Gwindow.PIXI.Graphics();}
  293. if(typeof(scope.container)=='undefined'){scope.container = new Gwindow.PIXI.Container();container.addChild(pixiCircle);}
  294. if(typeof(scope.canvasWidth)=='undefined'){scope.canvasWidth = -1;}
  295. if(typeof(scope.savedrooms)=='undefined'){scope.savedrooms = [];}
  296. if(typeof(scope.inroom)=='undefined'){scope.inroom = false;}
  297. if(typeof(scope.currentroomaddress)=='undefined'){scope.currentroomaddress = -1;}
  298. if(typeof(scope.savedroomsdata)=='undefined'){scope.savedroomsdata = {};}
  299. if(typeof(scope.jukeboxplayerURL)=='undefined'){scope.jukeboxplayerURL = "";}
  300. if(typeof(scope.jukeboxplayervolume)=='undefined'){scope.jukeboxplayervolume = 20;}
  301.  
  302.  
  303.  
  304. if(typeof(scope.requestAnimationFrameOriginal)=='undefined'){scope.requestAnimationFrameOriginal = Gwindow.requestAnimationFrame;}
  305.  
  306.  
  307. if(typeof(scope.bonkwss)=='undefined'){scope.bonkwss = 0;}
  308. if(typeof(scope.bonkwssextra)=='undefined'){scope.bonkwssextra = [];}
  309. if(typeof(scope.chatlog)=='undefined'){scope.chatlog = ["ROOM START"];}
  310. if(typeof(scope.wsssendrecievelog)=='undefined'){scope.wsssendrecievelog = [];}
  311. if(typeof(scope.wsssendlog)=='undefined'){scope.wsssendlog = [];}
  312. if(typeof(scope.wssrecievelog)=='undefined'){scope.wssrecievelog = [];}
  313. if(typeof(scope.wsslogpaused)=='undefined'){scope.wsslogpaused = false;}
  314. if(typeof(scope.debuggeropen)=='undefined'){scope.debuggeropen = false;}
  315. if(typeof(scope.debuggercount)=='undefined'){scope.debuggercount = true;}
  316. if(typeof(scope.packetcount)=='undefined'){scope.packetcount = 0;}
  317. if(typeof(scope.requestedmaps)=='undefined'){scope.requestedmaps = [];}
  318. if(typeof(scope.maponclick)=='undefined'){scope.maponclick = 0;}
  319. if(typeof(scope.LZString)=='undefined'){scope.LZString = Gwindow.LZString;}
  320. if(typeof(scope.PSON)=='undefined'){scope.PSON = Gwindow.dcodeIO.PSON;}
  321. if(typeof(scope.bytebuffer)=='undefined'){scope.bytebuffer = Gwindow.dcodeIO.ByteBuffer;}
  322. if(typeof(scope.speech)=='undefined'){scope.speech = new SpeechSynthesisUtterance();speech.pitch = 0.75;}
  323. if(typeof(scope.sayer)=='undefined'){scope.sayer = speechSynthesis;sayer.volume = 0.5;sayer.rate = 1.25;}
  324. if(typeof(scope.pollactive)=='undefined'){scope.pollactive = [false,0,0,[]];}
  325. if(typeof(scope.pollactive2)=='undefined'){scope.pollactive2 = [false,0,[]];}
  326. if(typeof(scope.mode)=='undefined'){scope.mode = '';}
  327. if(typeof(scope.FFA)=='undefined'){scope.FFA = true;}
  328. if(typeof(scope.recording)=='undefined'){scope.recording = false;}
  329. if(typeof(scope.recordingdata)=='undefined'){scope.recordingdata = [];}
  330. if(typeof(scope.recorddata)=='undefined'){scope.recorddata = {};}
  331. if(typeof(scope.recordingid)=='undefined'){scope.recordingid = -1;}
  332.  
  333.  
  334.  
  335. if(typeof(scope.ISpsonpair)=='undefined'){scope.ISpsonpair = new Gwindow.dcodeIO.PSON.StaticPair(["physics", "shapes", "fixtures", "bodies", "bro", "joints", "ppm", "lights", "spawns", "lasers", "capZones", "type", "w", "h", "c", "a", "v", "l", "s", "sh", "fr", "re", "de", "sn", "fc", "fm", "f", "d", "n", "bg", "lv", "av", "ld", "ad", "fr", "bu", "cf", "rv", "p", "d", "bf", "ba", "bb", "aa", "ab", "axa", "dr", "em", "mmt", "mms", "ms", "ut", "lt", "New body", "Box Shape", "Circle Shape", "Polygon Shape", "EdgeChain Shape", "priority", "Light", "Laser", "Cap Zone", "BG Shape", "Background Layer", "Rotate Joint", "Slider Joint", "Rod Joint", "Gear Joint", 65535, 16777215]);}
  336. if(typeof(scope.sandboxon)=='undefined'){scope.sandboxon = false;}
  337. if(typeof(scope.sandboxid)=='undefined'){scope.sandboxid = 200;}
  338. if(typeof(scope.playerids)=='undefined'){scope.playerids = {};}
  339. if(typeof(scope.delplayerids)=='undefined'){scope.delplayerids = {};}
  340. if(typeof(scope.myid)=='undefined'){scope.myid = -1;}
  341. if(typeof(scope.hostid)=='undefined'){scope.hostid = -1;}
  342. if(typeof(scope.sandboxplayerids)=='undefined'){scope.sandboxplayerids = {};}
  343. if(typeof(scope.originalMapLoad)=='undefined'){scope.originalMapLoad = Gdocument.getElementById("maploadwindowmapscontainer").appendChild;}
  344. if(typeof(scope.originalLobbyChat)=='undefined'){scope.originalLobbyChat = Gdocument.getElementById("newbonklobby_chat_content").appendChild;}
  345. if(typeof(scope.originalIngameChat)=='undefined'){scope.originalIngameChat = Gdocument.getElementById("ingamechatcontent").appendChild;}
  346. 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];}
  347.  
  348. if(typeof(scope.jukeboxplayer)=='undefined'){
  349. scope.jukeboxplayer = Gdocument.createElement("audio");
  350. jukeboxplayer.controls = true;
  351. jukeboxplayer.loop = true;
  352. }
  353.  
  354. if(Gdocument.getElementById("savedroombutton") == null){
  355. scope.savedroombutton = Gdocument.createElement("div");
  356. savedroombutton.id = "savedroombutton";
  357. savedroombutton.className = "brownButton brownButton_classic buttonShadow brownButtonDisabled";
  358. savedroombutton.textContent = "Save Room";
  359. savedroombutton.style["left"] = "120px";
  360. savedroombutton.style["position"] = "absolute";
  361. savedroombutton.style["width"] = "90px";
  362. savedroombutton.style["height"] = "30px";
  363. savedroombutton.style["color"] = "#ffffff";
  364. savedroombutton.style["text-align"] = "center";
  365. savedroombutton.style["vertical-align"] = "middle";
  366. savedroombutton.style["line-height"] = "30px";
  367. savedroombutton.style["right"] = "0";
  368. savedroombutton.style["cursor"] = "pointer";
  369. savedroombutton.style["bottom"] = "10px";
  370. savedroombutton.style["margin"] = "auto";
  371. savedroombutton.style["bottom"] = "10px";
  372. savedroombutton.onclick = function(){
  373. if(!savedrooms.includes(currentroomaddress) && currentroomaddress!=-1){
  374. savedrooms.push(currentroomaddress);
  375. savedroomsdata[currentroomaddress] = {"exists":true};
  376. }
  377. Gdocument.getElementById("sm_connectingWindowCancelButton").click();
  378. };
  379. Gdocument.getElementById("sm_connectingWindowCancelButton").style["left"] = "-120px";
  380. Gdocument.getElementById("sm_connectingWindow").appendChild(savedroombutton)
  381. }
  382. if(Gdocument.getElementById("maploadtypedropdowntitlerequested") == null){
  383. scope.clearmaprequests = Gdocument.createElement("div");
  384. clearmaprequests.id = "clearmaprequests";
  385. clearmaprequests.classList.value = "brownButton brownButton_classic buttonShadow";
  386. clearmaprequests.textContent = "Clear";
  387. clearmaprequests.style["position"] = "absolute";
  388. clearmaprequests.style["display"] = "none";
  389. if(typeof(ishost)!='undefined'){
  390. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  391. clearmaprequests.style["display"] = "block";
  392. }
  393. }
  394. clearmaprequests.style["right"] = "306px";
  395. clearmaprequests.style["top"] = "57px";
  396. clearmaprequests.style["height"] = "23px";
  397. clearmaprequests.style["width"] = "47px";
  398. clearmaprequests.style["line-height"] = "23px";
  399. clearmaprequests.style["font-size"] = "14px";
  400. clearmaprequests.addEventListener("click",function(){
  401. requestedmaps = [];
  402. Gdocument.getElementById("maploadwindowstatustext").style["visibility"] = "inherit";
  403. Gdocument.getElementById("maploadwindowstatustext").textContent = "No Maps";
  404. while(Gdocument.getElementById("maploadwindowmapscontainer").children.length>0){
  405. Gdocument.getElementById("maploadwindowmapscontainer").removeChild(Gdocument.getElementById("maploadwindowmapscontainer").firstChild);
  406. }
  407. });
  408. Gdocument.getElementById("maploadwindow").insertBefore(clearmaprequests,Gdocument.getElementById("maploadwindowsearchinput"));
  409. scope.refreshmaprequests = Gdocument.createElement("div");
  410. refreshmaprequests.id = "refreshmaprequests";
  411. refreshmaprequests.classList.value = "brownButton brownButton_classic buttonShadow";
  412. refreshmaprequests.textContent = "Refresh";
  413. refreshmaprequests.style["position"] = "absolute";
  414. refreshmaprequests.style["display"] = "none";
  415. if(typeof(ishost)!='undefined'){
  416. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  417. refreshmaprequests.style["display"] = "block";
  418. }
  419. }
  420. refreshmaprequests.style["right"] = "357px";
  421. refreshmaprequests.style["top"] = "57px";
  422. refreshmaprequests.style["height"] = "23px";
  423. refreshmaprequests.style["width"] = "47px";
  424. refreshmaprequests.style["line-height"] = "23px";
  425. refreshmaprequests.style["font-size"] = "14px";
  426. refreshmaprequests.addEventListener("click",function(){
  427. searchrequested = 1;
  428. Gdocument.getElementById("maploadtypedropdowntitle").click();
  429. Gdocument.getElementById("maploadtypedropdowntitle").textContent = dropdownrequested.textContent;
  430. dropdownrequested.style["display"] = "none";
  431. clearmaprequests.style["display"] = "block";
  432. refreshmaprequests.style["display"] = "block";
  433. Gdocument.getElementById("maploadwindowhotnessslider").style["visibility"] = "hidden";
  434. Gdocument.getElementById("maploadwindowsearchoptions").style["visibility"] = "hidden";
  435. Gdocument.getElementById("maploadtypedropdownoption10").click();
  436. });
  437. Gdocument.getElementById("maploadwindow").insertBefore(refreshmaprequests,Gdocument.getElementById("maploadwindowsearchinput"));
  438.  
  439. scope.dropdownrequested = Gdocument.createElement("div");
  440. dropdownrequested.classList = "dropdown-option dropdown_classic";
  441. dropdownrequested.style["display"] = "none";
  442. dropdownrequested.id = "maploadtypedropdowntitlerequested";
  443.  
  444. if(Gdocument.getElementById("maploadtypedropdownoption10").style["display"] == "block"){
  445. dropdownrequested.style["display"] = "block";
  446. }
  447. dropdownrequested.textContent = "MAP REQUESTS";
  448. dropdownrequested.onclick = function(){
  449. searchrequested = 1;
  450. Gdocument.getElementById("maploadtypedropdowntitle").click();
  451. Gdocument.getElementById("maploadtypedropdowntitle").textContent = dropdownrequested.textContent;
  452. dropdownrequested.style["display"] = "none";
  453. clearmaprequests.style["display"] = "block";
  454. refreshmaprequests.style["display"] = "block";
  455. Gdocument.getElementById("maploadwindowhotnessslider").style["visibility"] = "hidden";
  456. Gdocument.getElementById("maploadwindowsearchoptions").style["visibility"] = "hidden";
  457. Gdocument.getElementById("maploadtypedropdownoption10").click();
  458. };
  459. (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});
  460. Gdocument.getElementById("maploadtypedropdown").insertBefore(dropdownrequested,Gdocument.getElementById("maploadtypedropdownoption1"));
  461. Gdocument.getElementById("maploadwindowmapscontainer").__defineGetter__("clientHeight",function(){if(Gdocument.getElementById("maploadtypedropdowntitle").textContent != "MAP REQUESTS"){return Gdocument.getElementById("maploadwindowmapscontainer").getClientRects()[0].height;}else{return 0;}});
  462.  
  463. };
  464. scope.sandboxonclick = function(){
  465. Gdocument.getElementById("roomlistrefreshbutton").click();
  466. Gdocument.getElementById("roomlistcreatebutton").click();
  467. sandboxon = true;
  468. };
  469. scope.checkboxclearbuttononclick = function(){
  470. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  471. var e = true;
  472. for(var i = 0; i<classes.length;i++){
  473. if(classes[i].checked == true){
  474. e = false
  475. }
  476. classes[i].checked = false;
  477. }
  478. if(e){
  479. for(var i = 0; i<classes.length;i++){
  480. classes[i].checked = true;
  481. }
  482. }
  483. };
  484. Gdocument.getElementById("ingamechatcontent").__defineGetter__("childElementCount",function(){return this.children.length/50;});
  485. if(Gdocument.getElementById("classic_mid_sandbox")==null){
  486. Gdocument.getElementById("roomlistrefreshbutton").click();
  487. scope.sandboxbutton = Gdocument.createElement("div");
  488. sandboxbutton.id = "classic_mid_sandbox";
  489. sandboxbutton.classList.value = "brownButton brownButton_classic classic_mid_buttons";
  490. sandboxbutton.textContent = "Sandbox";
  491. sandboxbutton.addEventListener("click",sandboxonclick);
  492. Gdocument.getElementById("classic_mid").insertBefore(sandboxbutton,Gdocument.getElementById("classic_mid_news"));
  493.  
  494. }
  495. if(Gdocument.getElementById("clearallcheckboxes")==null){
  496. scope.checkboxclearbutton = Gdocument.createElement("div");
  497. checkboxclearbutton.id = "clearallcheckboxes";
  498. checkboxclearbutton.classList.value = "brownButton brownButton_classic buttonShadow";
  499. checkboxclearbutton.textContent = "On/Off";
  500. checkboxclearbutton.style["position"] = "absolute";
  501. checkboxclearbutton.style["display"] = "none";
  502. if(typeof(ishost)!='undefined'){
  503. if(ishost && stopquickplay == 0){
  504. checkboxclearbutton.style["display"] = "block";
  505. }
  506. }
  507. checkboxclearbutton.style["right"] = "255px";
  508. checkboxclearbutton.style["top"] = "57px";
  509. checkboxclearbutton.style["height"] = "23px";
  510. checkboxclearbutton.style["width"] = "47px";
  511. checkboxclearbutton.style["line-height"] = "23px";
  512. checkboxclearbutton.style["font-size"] = "13px";
  513. checkboxclearbutton.addEventListener("click",checkboxclearbuttononclick);
  514. Gdocument.getElementById("maploadwindow").insertBefore(checkboxclearbutton,Gdocument.getElementById("maploadwindowsearchinput"));
  515.  
  516. }
  517. scope.holdloadbuttonTimeout = [];
  518. scope.holdloadbutton = function(){
  519. var scrollcount = 0;
  520. var mapwindow = Gdocument.getElementById("maploadwindowmapscontainer");
  521. mapwindow.scroll(0,mapwindow.scrollHeight);
  522. };
  523.  
  524. if(Gdocument.getElementById("mapwindowloadall")==null){
  525. scope.loadall = Gdocument.createElement("div");
  526. loadall.id = "mapwindowloadall";
  527. loadall.classList.value = "brownButton brownButton_classic buttonShadow";
  528. loadall.textContent = "Load";
  529. loadall.style["position"] = "absolute";
  530. loadall.style["display"] = "block";
  531. loadall.style["left"] = "204px";
  532. loadall.style["top"] = "57px";
  533. loadall.style["height"] = "23px";
  534. loadall.style["width"] = "34px";
  535. loadall.style["line-height"] = "23px";
  536. loadall.style["font-size"] = "12px";
  537. var repeat = function(){holdloadbutton();holdloadbuttonTimeout.push(setTimeout(repeat,25));};
  538. loadall.onmousedown = function(){repeat();};
  539. loadall.onmouseup = function(){for(var i = 0; i<holdloadbuttonTimeout.length; i++){clearTimeout(holdloadbuttonTimeout[i]);}};
  540. loadall.onmouseout = function(){for(var i = 0; i<holdloadbuttonTimeout.length; i++){clearTimeout(holdloadbuttonTimeout[i]);}};
  541.  
  542. Gdocument.getElementById("maploadwindow").insertBefore(loadall,Gdocument.getElementById("maploadwindowsearchinput"));
  543.  
  544. }
  545. if(Gdocument.getElementById("BonkCommandsDebuggerContainer")==null){
  546. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=3;
  547. scope.debuggermenu = Gdocument.createElement("div");
  548. debuggermenu.id = "BonkCommandsDebuggerContainer";
  549. debuggermenu.style["position"] = "absolute";
  550. debuggermenu.style["display"] = "none";
  551. if(typeof(debuggeropen)!='undefined'){
  552. if(debuggeropen){
  553. debuggermenu.style["display"] = "block";
  554. }
  555. }
  556. debuggermenu.style["width"] = Gdocument.getElementById("bonkiocontainer").style["width"];
  557. debuggermenu.style["height"] = Gdocument.getElementById("bonkiocontainer").style["height"];
  558.  
  559. debuggermenu.style["background"] = "rgb(26, 39, 51)";
  560.  
  561. scope.width = parseInt(Gdocument.getElementById("bonkiocontainer").style["width"])-20;
  562. scope.height = parseInt(Gdocument.getElementById("bonkiocontainer").style["height"])-210;
  563.  
  564. scope.logmenu = Gdocument.createElement("div");
  565. logmenu.id = "BonkCommandsWebSocketLog";
  566. logmenu.style["position"] = "absolute";
  567. logmenu.style["width"] = width.toString()+"px";
  568. logmenu.style["height"] = height.toString()+"px";
  569. logmenu.style["top"] = "80px";
  570. logmenu.style["left"] = "10px";
  571. logmenu.style["background"] = "rgb(207, 216, 220)";
  572. scope.logmenutopleft = Gdocument.createElement("div");
  573. logmenutopleft.id = "BonkCommandsWebSocketLog";
  574. logmenutopleft.style["position"] = "absolute";
  575. logmenutopleft.textContent = "Sending";
  576. logmenutopleft.classList = "newbonklobby_boxtop newbonklobby_boxtop_classic";
  577. logmenutopleft.style["width"] = (width/2).toString()+"px";
  578. logmenutopleft.style["height"] = "30px";
  579. logmenutopleft.style["top"] = "-30px";
  580. logmenutopleft.style["background"] = "rgb(0, 150, 136)";
  581. logmenu.appendChild(logmenutopleft);
  582. scope.logmenutopright = Gdocument.createElement("div");
  583. logmenutopright.id = "BonkCommandsWebSocketLog";
  584. logmenutopright.style["position"] = "absolute";
  585. logmenutopright.textContent = "Recieving";
  586. logmenutopright.classList = "newbonklobby_boxtop newbonklobby_boxtop_classic";
  587. logmenutopright.style["width"] = (width/2).toString()+"px";
  588. logmenutopright.style["height"] = "30px";
  589. logmenutopright.style["left"] = (width/2).toString()+"px";
  590. logmenutopright.style["top"] = "-30px";
  591. logmenutopright.style["background"] = "rgb(0, 150, 136)";
  592. logmenu.appendChild(logmenutopright);
  593. scope.logmenutable = Gdocument.createElement("table");
  594. logmenutable.id = "BonkCommandsWebSocketTable";
  595. logmenutable.style["position"] = "absolute";
  596. logmenutable.style["border-spacing"] = "0px";
  597. logmenutable.style["font-size"] = "12px";
  598. logmenutable.style["display"] = "table-cell";
  599. logmenutable.style["width"] = "50%";
  600. logmenutable.style["height"] = "100%";
  601. logmenutable.style["table-layout"] = "fixed";
  602. logmenutable.style["overflow-y"] = "scroll";
  603.  
  604. scope.logmenutable2 = Gdocument.createElement("table");
  605. logmenutable2.id = "BonkCommandsWebSocketTable2";
  606. logmenutable2.style["position"] = "absolute";
  607. logmenutable2.style["width"] = "50%";
  608. logmenutable2.style["left"] = "50%";
  609. logmenutable2.style["font-size"] = "12px";
  610. logmenutable2.style["display"] = "table-cell";
  611. logmenutable2.style["height"] = "100%";
  612. logmenutable2.style["table-layout"] = "fixed";
  613. logmenutable2.style["overflow-y"] = "scroll";
  614. logmenutable2.style["border-spacing"] = "0px";
  615. scope.leftsync = false;
  616. scope.rightsync = false;
  617. logmenutable2.onscroll = function(){
  618. if(!leftsync){
  619. rightsync = true;
  620. logmenutable.scrollTop = this.scrollTop;
  621. }
  622. else{
  623. leftsync = false;
  624. }
  625. };
  626. logmenutable.onscroll = function(){
  627. if(!rightsync){
  628. leftsync = true;
  629. logmenutable2.scrollTop = this.scrollTop;
  630. }
  631. else{
  632. rightsync = false
  633. }
  634. };
  635. logmenu.appendChild(logmenutable);
  636. logmenu.appendChild(logmenutable2);
  637. debuggermenu.appendChild(logmenu);
  638. scope.debuggermenuclose = Gdocument.createElement("div");
  639. debuggermenuclose.id = "debuggerclose";
  640. debuggermenuclose.classList = "windowCloseButton brownButton brownButton_classic buttonShadow";
  641. debuggermenuclose.style["position"] = "absolute";
  642. debuggermenuclose.style["top"] = "40px";
  643. debuggermenuclose.style["right"] = "5px";
  644. debuggermenuclose.onclick = function(){debuggeropen = false;debuggermenu.style["display"] = "none";Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  645. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";};
  646. debuggermenu.appendChild(debuggermenuclose);
  647. scope.debuggerform = Gdocument.createElement("form");
  648. debuggerform.autocomplete = "off";
  649. scope.debuggerinput = Gdocument.createElement("input");
  650. debuggerinput.style["position"] = "absolute";
  651. debuggerinput.style["width"] = width.toString()+"px";
  652. debuggerinput.style["left"] = "10px";
  653. debuggerinput.style["top"] = (height+90).toString()+"px";
  654. debuggerinput.style["font-size"] = "12px";
  655. debuggerinput.style["height"] = "20px";
  656. debuggerform.appendChild(debuggerinput);
  657. scope.debuggersendrecieve = Gdocument.createElement("div");
  658. debuggersendrecieve.style["position"] = "absolute";
  659. debuggersendrecieve.style["width"] = "140px";
  660. debuggersendrecieve.style["left"] = "10px";
  661. debuggersendrecieve.style["top"] = (height+120).toString()+"px";
  662. debuggersendrecieve.style["font-size"] = "15px";
  663. debuggersendrecieve.style["height"] = "20px";
  664. debuggersendrecieve.classList = "brownButton brownButton_classic buttonShadow";
  665. debuggersendrecieve.textContent = "Send";
  666. debuggersendrecieve.value = 0;
  667. debuggersendrecieve.onclick = function(){if(this.value == 0){this.textContent = "Recieve";this.value = 1;}else{this.textContent = "Send";this.value = 0;}};
  668.  
  669. debuggermenu.appendChild(debuggersendrecieve);
  670. scope.debuggerpausebutton = Gdocument.createElement("div");
  671. debuggerpausebutton.style["position"] = "absolute";
  672. debuggerpausebutton.style["width"] = "140px";
  673. debuggerpausebutton.style["left"] = "10px";
  674. debuggerpausebutton.style["top"] = (height+150).toString()+"px";
  675. debuggerpausebutton.style["font-size"] = "15px";
  676. debuggerpausebutton.style["height"] = "20px";
  677. debuggerpausebutton.classList = "brownButton brownButton_classic buttonShadow";
  678. debuggerpausebutton.textContent = "Pause";
  679. debuggerpausebutton.value = 0;
  680. debuggerpausebutton.onclick = function(){if(this.value == 0){this.textContent = "Play";this.value = 1;wsslogpaused = true}else{this.textContent = "Pause";this.value = 0;wsslogpaused = false;}};
  681.  
  682. debuggermenu.appendChild(debuggerpausebutton);
  683. scope.debuggereval = Gdocument.createElement("input");
  684. debuggereval.style["position"] = "absolute";
  685. debuggereval.style["width"] = (width-150).toString()+"px";
  686. debuggereval.style["right"] = "10px";
  687. debuggereval.style["top"] = (height+120).toString()+"px";
  688. debuggereval.style["font-size"] = "12px";
  689. debuggereval.style["height"] = "20px";
  690. debuggereval.addEventListener("keypress",function(e){if(e.repeat){return;}if(e.code == "Enter" && this.value.length>0){if(debuggersendrecieve.value == 0){SEND(this.value);}else{RECIEVE(this.value);}}});
  691. debuggerform.appendChild(debuggereval);
  692. debuggermenu.appendChild(debuggerform);
  693. Gdocument.getElementById("newbonkgamecontainer").appendChild(debuggermenu);
  694.  
  695. }
  696. scope.ISdecode = function(rawdata) {
  697. rawdata_caseflipped = "";
  698. for (i = 0; i < rawdata.length; i++) {
  699. if (i <= 100 && rawdata.charAt(i) === rawdata.charAt(i).toLowerCase()) {
  700. rawdata_caseflipped += rawdata.charAt(i).toUpperCase();
  701. } else if (i <= 100 && rawdata.charAt(i) === rawdata.charAt(i).toUpperCase()) {
  702. rawdata_caseflipped += rawdata.charAt(i).toLowerCase();
  703. } else {
  704. rawdata_caseflipped += rawdata.charAt(i);
  705. }
  706. }
  707.  
  708. data_deLZd = LZString.decompressFromEncodedURIComponent(rawdata_caseflipped);
  709. databuffer = bytebuffer.fromBase64(data_deLZd);
  710. data = ISpsonpair.decode(databuffer.buffer);
  711. return data;
  712. };
  713. scope.ISencode = function(obj) {
  714. data = ISpsonpair.encode(obj);
  715. b64 = data.toBase64();
  716. lzd = LZString.compressToEncodedURIComponent(b64);
  717.  
  718. caseflipped = "";
  719. for (i = 0; i < lzd.length; i++) {
  720. if (i <= 100 && lzd.charAt(i) === lzd.charAt(i).toLowerCase()) {
  721. caseflipped += lzd.charAt(i).toUpperCase();
  722. } else if (i <= 100 && lzd.charAt(i) === lzd.charAt(i).toUpperCase()) {
  723. caseflipped += lzd.charAt(i).toLowerCase();
  724. } else {
  725. caseflipped += lzd.charAt(i);
  726. }
  727. }
  728.  
  729.  
  730. return caseflipped;
  731. };
  732. scope.decodeIS = function(x){
  733. return ISdecode(x);
  734. };
  735. scope.encodeIS = function(x){
  736. return ISencode(x);
  737. };
  738. scope.encodeToDatabase = function (W2A) {
  739. var M3n = [arguments];
  740. M3n[1] = new bytebuffer2;
  741. M3n[9] = M3n[0][0].physics;
  742. M3n[0][0].v = 14;
  743. M3n[1].writeShort(M3n[0][0].v);
  744. M3n[1].writeBoolean(M3n[0][0].s.re);
  745. M3n[1].writeBoolean(M3n[0][0].s.nc);
  746. M3n[1].writeShort(M3n[0][0].s.pq);
  747. M3n[1].writeFloat(M3n[0][0].s.gd);
  748. M3n[1].writeBoolean(M3n[0][0].s.fl);
  749. M3n[1].writeUTF(M3n[0][0].m.rxn);
  750. M3n[1].writeUTF(M3n[0][0].m.rxa);
  751. M3n[1].writeUint(M3n[0][0].m.rxid);
  752. M3n[1].writeShort(M3n[0][0].m.rxdb);
  753. M3n[1].writeUTF(M3n[0][0].m.n);
  754. M3n[1].writeUTF(M3n[0][0].m.a);
  755. M3n[1].writeUint(M3n[0][0].m.vu);
  756. M3n[1].writeUint(M3n[0][0].m.vd);
  757. M3n[1].writeShort(M3n[0][0].m.cr.length);
  758. for (
  759. M3n[84] = 0;
  760. M3n[84] < M3n[0][0].m.cr.length;
  761. M3n[84]++
  762. ) {
  763. M3n[1].writeUTF(M3n[0][0].m.cr[M3n[84]]);
  764. }
  765. M3n[1].writeUTF(M3n[0][0].m.mo);
  766. M3n[1].writeInt(M3n[0][0].m.dbid);
  767. M3n[1].writeBoolean(M3n[0][0].m.pub);
  768. M3n[1].writeInt(M3n[0][0].m.dbv);
  769. M3n[1].writeShort(M3n[9].ppm);
  770. M3n[1].writeShort(M3n[9].bro.length);
  771. for (M3n[17] = 0; M3n[17] < M3n[9].bro.length; M3n[17]++) {
  772. M3n[1].writeShort(M3n[9].bro[M3n[17]]);
  773. }
  774. M3n[1].writeShort(M3n[9].shapes.length);
  775. for (M3n[80] = 0; M3n[80] < M3n[9].shapes.length; M3n[80]++) {
  776. M3n[2] = M3n[9].shapes[M3n[80]];
  777. if (M3n[2].type == "bx") {
  778. M3n[1].writeShort(1);
  779. M3n[1].writeDouble(M3n[2].w);
  780. M3n[1].writeDouble(M3n[2].h);
  781. M3n[1].writeDouble(M3n[2].c[0]);
  782. M3n[1].writeDouble(M3n[2].c[1]);
  783. M3n[1].writeDouble(M3n[2].a);
  784. M3n[1].writeBoolean(M3n[2].sk);
  785. }
  786. if (M3n[2].type == "ci") {
  787. M3n[1].writeShort(2);
  788. M3n[1].writeDouble(M3n[2].r);
  789. M3n[1].writeDouble(M3n[2].c[0]);
  790. M3n[1].writeDouble(M3n[2].c[1]);
  791. M3n[1].writeBoolean(M3n[2].sk);
  792. }
  793. if (M3n[2].type == "po") {
  794. M3n[1].writeShort(3);
  795. M3n[1].writeDouble(M3n[2].s);
  796. M3n[1].writeDouble(M3n[2].a);
  797. M3n[1].writeDouble(M3n[2].c[0]);
  798. M3n[1].writeDouble(M3n[2].c[1]);
  799. M3n[1].writeShort(M3n[2].v.length);
  800. for (M3n[61] = 0; M3n[61] < M3n[2].v.length; M3n[61]++) {
  801. M3n[1].writeDouble(M3n[2].v[M3n[61]][0]);
  802. M3n[1].writeDouble(M3n[2].v[M3n[61]][1]);
  803. }
  804. }
  805. }
  806. M3n[1].writeShort(M3n[9].fixtures.length);
  807. for (M3n[20] = 0; M3n[20] < M3n[9].fixtures.length; M3n[20]++) {
  808. M3n[7] = M3n[9].fixtures[M3n[20]];
  809. M3n[1].writeShort(M3n[7].sh);
  810. M3n[1].writeUTF(M3n[7].n);
  811. if (M3n[7].fr === null) {
  812. M3n[1].writeDouble(Number.MAX_VALUE);
  813. } else {
  814. M3n[1].writeDouble(M3n[7].fr);
  815. }
  816. if (M3n[7].fp === null) {
  817. M3n[1].writeShort(0);
  818. }
  819. if (M3n[7].fp === false) {
  820. M3n[1].writeShort(1);
  821. }
  822. if (M3n[7].fp === true) {
  823. M3n[1].writeShort(2);
  824. }
  825. if (M3n[7].re === null) {
  826. M3n[1].writeDouble(Number.MAX_VALUE);
  827. } else {
  828. M3n[1].writeDouble(M3n[7].re);
  829. }
  830. if (M3n[7].de === null) {
  831. M3n[1].writeDouble(Number.MAX_VALUE);
  832. } else {
  833. M3n[1].writeDouble(M3n[7].de);
  834. }
  835. M3n[1].writeUint(M3n[7].f);
  836. M3n[1].writeBoolean(M3n[7].d);
  837. M3n[1].writeBoolean(M3n[7].np);
  838. M3n[1].writeBoolean(M3n[7].ng);
  839. M3n[1].writeBoolean(M3n[7].ig);
  840. }
  841. M3n[1].writeShort(M3n[9].bodies.length);
  842. for (M3n[37] = 0; M3n[37] < M3n[9].bodies.length; M3n[37]++) {
  843. M3n[4] = M3n[9].bodies[M3n[37]];
  844. M3n[1].writeUTF(M3n[4].type);
  845. M3n[1].writeUTF(M3n[4].n);
  846. M3n[1].writeDouble(M3n[4].p[0]);
  847. M3n[1].writeDouble(M3n[4].p[1]);
  848. M3n[1].writeDouble(M3n[4].a);
  849. M3n[1].writeDouble(M3n[4].fric);
  850. M3n[1].writeBoolean(M3n[4].fricp);
  851. M3n[1].writeDouble(M3n[4].re);
  852. M3n[1].writeDouble(M3n[4].de);
  853. M3n[1].writeDouble(M3n[4].lv[0]);
  854. M3n[1].writeDouble(M3n[4].lv[1]);
  855. M3n[1].writeDouble(M3n[4].av);
  856. M3n[1].writeDouble(M3n[4].ld);
  857. M3n[1].writeDouble(M3n[4].ad);
  858. M3n[1].writeBoolean(M3n[4].fr);
  859. M3n[1].writeBoolean(M3n[4].bu);
  860. M3n[1].writeDouble(M3n[4].cf.x);
  861. M3n[1].writeDouble(M3n[4].cf.y);
  862. M3n[1].writeDouble(M3n[4].cf.ct);
  863. M3n[1].writeBoolean(M3n[4].cf.w);
  864. M3n[1].writeShort(M3n[4].f_c);
  865. M3n[1].writeBoolean(M3n[4].f_1);
  866. M3n[1].writeBoolean(M3n[4].f_2);
  867. M3n[1].writeBoolean(M3n[4].f_3);
  868. M3n[1].writeBoolean(M3n[4].f_4);
  869. M3n[1].writeBoolean(M3n[4].f_p);
  870. M3n[1].writeBoolean(M3n[4].fz.on);
  871. if (M3n[4].fz.on) {
  872. M3n[1].writeDouble(M3n[4].fz.x);
  873. M3n[1].writeDouble(M3n[4].fz.y);
  874. M3n[1].writeBoolean(M3n[4].fz.d);
  875. M3n[1].writeBoolean(M3n[4].fz.p);
  876. M3n[1].writeBoolean(M3n[4].fz.a);
  877. }
  878. M3n[1].writeShort(M3n[4].fx.length);
  879. for (M3n[28] = 0; M3n[28] < M3n[4].fx.length; M3n[28]++) {
  880. M3n[1].writeShort(M3n[4].fx[M3n[28]]);
  881. }
  882. }
  883. M3n[1].writeShort(M3n[0][0].spawns.length);
  884. for (
  885. M3n[30] = 0;
  886. M3n[30] < M3n[0][0].spawns.length;
  887. M3n[30]++
  888. ) {
  889. M3n[6] = M3n[0][0].spawns[M3n[30]];
  890. M3n[1].writeDouble(M3n[6].x);
  891. M3n[1].writeDouble(M3n[6].y);
  892. M3n[1].writeDouble(M3n[6].xv);
  893. M3n[1].writeDouble(M3n[6].yv);
  894. M3n[1].writeShort(M3n[6].priority);
  895. M3n[1].writeBoolean(M3n[6].r);
  896. M3n[1].writeBoolean(M3n[6].f);
  897. M3n[1].writeBoolean(M3n[6].b);
  898. M3n[1].writeBoolean(M3n[6].gr);
  899. M3n[1].writeBoolean(M3n[6].ye);
  900. M3n[1].writeUTF(M3n[6].n);
  901. }
  902. M3n[1].writeShort(M3n[0][0].capZones.length);
  903. for (
  904. M3n[74] = 0;
  905. M3n[74] < M3n[0][0].capZones.length;
  906. M3n[74]++
  907. ) {
  908. M3n[3] = M3n[0][0].capZones[M3n[74]];
  909. M3n[1].writeUTF(M3n[3].n);
  910. M3n[1].writeDouble(M3n[3].l);
  911. M3n[1].writeShort(M3n[3].i);
  912. M3n[1].writeShort(M3n[3].ty);
  913. }
  914. M3n[1].writeShort(M3n[9].joints.length);
  915. for (M3n[89] = 0; M3n[89] < M3n[9].joints.length; M3n[89]++) {
  916. M3n[5] = M3n[9].joints[M3n[89]];
  917. if (M3n[5].type == "rv") {
  918. M3n[1].writeShort(1);
  919. M3n[1].writeDouble(M3n[5].d.la);
  920. M3n[1].writeDouble(M3n[5].d.ua);
  921. M3n[1].writeDouble(M3n[5].d.mmt);
  922. M3n[1].writeDouble(M3n[5].d.ms);
  923. M3n[1].writeBoolean(M3n[5].d.el);
  924. M3n[1].writeBoolean(M3n[5].d.em);
  925. M3n[1].writeDouble(M3n[5].aa[0]);
  926. M3n[1].writeDouble(M3n[5].aa[1]);
  927. }
  928. if (M3n[5].type == "d") {
  929. M3n[1].writeShort(2);
  930. M3n[1].writeDouble(M3n[5].d.fh);
  931. M3n[1].writeDouble(M3n[5].d.dr);
  932. M3n[1].writeDouble(M3n[5].aa[0]);
  933. M3n[1].writeDouble(M3n[5].aa[1]);
  934. M3n[1].writeDouble(M3n[5].ab[0]);
  935. M3n[1].writeDouble(M3n[5].ab[1]);
  936. }
  937. if (M3n[5].type == "lpj") {
  938. M3n[1].writeShort(3);
  939. M3n[1].writeDouble(M3n[5].pax);
  940. M3n[1].writeDouble(M3n[5].pay);
  941. M3n[1].writeDouble(M3n[5].pa);
  942. M3n[1].writeDouble(M3n[5].pf);
  943. M3n[1].writeDouble(M3n[5].pl);
  944. M3n[1].writeDouble(M3n[5].pu);
  945. M3n[1].writeDouble(M3n[5].plen);
  946. M3n[1].writeDouble(M3n[5].pms);
  947. }
  948. if (M3n[5].type == "lsj") {
  949. M3n[1].writeShort(4);
  950. M3n[1].writeDouble(M3n[5].sax);
  951. M3n[1].writeDouble(M3n[5].say);
  952. M3n[1].writeDouble(M3n[5].sf);
  953. M3n[1].writeDouble(M3n[5].slen);
  954. }
  955. M3n[1].writeShort(M3n[5].ba);
  956. M3n[1].writeShort(M3n[5].bb);
  957. M3n[1].writeBoolean(M3n[5].d.cc);
  958. M3n[1].writeDouble(M3n[5].d.bf);
  959. M3n[1].writeBoolean(M3n[5].d.dl);
  960. }
  961. M3n[32] = M3n[1].toBase64();
  962. M3n[77] = LZString.compressToEncodedURIComponent(M3n[32]);
  963. return M3n[77];
  964. };
  965. scope.decodeFromDatabase = function (map) {
  966. var F5W = [arguments];
  967. var b64mapdata = LZString.decompressFromEncodedURIComponent(map);
  968. var binaryReader = new bytebuffer2;
  969. binaryReader.fromBase64(b64mapdata, false);
  970. 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: "", }};
  971. map.physics = map.physics;
  972. map.v = binaryReader.readShort();
  973. if (map.v > 14) {
  974. throw new Error("Future map version, please refresh page");
  975. }
  976. map.s.re = binaryReader.readBoolean();
  977. map.s.nc = binaryReader.readBoolean();
  978. if (map.v >= 3) {
  979. map.s.pq = binaryReader.readShort();
  980. }
  981. if (map.v >= 4 && map.v <= 12) {
  982. map.s.gd = binaryReader.readShort();
  983. } else if (map.v >= 13) {
  984. map.s.gd = binaryReader.readFloat();
  985. }
  986. if (map.v >= 9) {
  987. map.s.fl = binaryReader.readBoolean();
  988. }
  989. map.m.rxn = binaryReader.readUTF();
  990. map.m.rxa = binaryReader.readUTF();
  991. map.m.rxid = binaryReader.readUint();
  992. map.m.rxdb = binaryReader.readShort();
  993. map.m.n = binaryReader.readUTF();
  994. map.m.a = binaryReader.readUTF();
  995. if (map.v >= 10) {
  996. map.m.vu = binaryReader.readUint();
  997. map.m.vd = binaryReader.readUint();
  998. }
  999. if (map.v >= 4) {
  1000. F5W[7] = binaryReader.readShort();
  1001. for (F5W[83] = 0; F5W[83] < F5W[7]; F5W[83]++) {
  1002. map.m.cr.push(binaryReader.readUTF());
  1003. }
  1004. }
  1005. if (map.v >= 5) {
  1006. map.m.mo = binaryReader.readUTF();
  1007. map.m.dbid = binaryReader.readInt();
  1008. }
  1009. if (map.v >= 7) {
  1010. map.m.pub = binaryReader.readBoolean();
  1011. }
  1012. if (map.v >= 8) {
  1013. map.m.dbv = binaryReader.readInt();
  1014. }
  1015. map.physics.ppm = binaryReader.readShort();
  1016. F5W[4] = binaryReader.readShort();
  1017. for (F5W[15] = 0; F5W[15] < F5W[4]; F5W[15]++) {
  1018. map.physics.bro[F5W[15]] = binaryReader.readShort();
  1019. }
  1020. F5W[6] = binaryReader.readShort();
  1021. for (F5W[28] = 0; F5W[28] < F5W[6]; F5W[28]++) {
  1022. F5W[5] = binaryReader.readShort();
  1023. if (F5W[5] == 1) {
  1024. map.physics.shapes[F5W[28]] = { type: "bx", w: 10, h: 40, c: [0, 0], a: 0.0, sk: false };
  1025. map.physics.shapes[F5W[28]].w = binaryReader.readDouble();
  1026. map.physics.shapes[F5W[28]].h = binaryReader.readDouble();
  1027. map.physics.shapes[F5W[28]].c = [
  1028. binaryReader.readDouble(),
  1029. binaryReader.readDouble(),
  1030. ];
  1031. map.physics.shapes[F5W[28]].a = binaryReader.readDouble();
  1032. map.physics.shapes[F5W[28]].sk = binaryReader.readBoolean();
  1033. }
  1034. if (F5W[5] == 2) {
  1035. map.physics.shapes[F5W[28]] = { type: "ci", r: 25, c: [0, 0], sk: false };
  1036. map.physics.shapes[F5W[28]].r = binaryReader.readDouble();
  1037. map.physics.shapes[F5W[28]].c = [
  1038. binaryReader.readDouble(),
  1039. binaryReader.readDouble(),
  1040. ];
  1041. map.physics.shapes[F5W[28]].sk = binaryReader.readBoolean();
  1042. }
  1043. if (F5W[5] == 3) {
  1044. map.physics.shapes[F5W[28]] = { type: "po", v: [], s: 1, a: 0, c: [0, 0] };
  1045. map.physics.shapes[F5W[28]].s = binaryReader.readDouble();
  1046. map.physics.shapes[F5W[28]].a = binaryReader.readDouble();
  1047. map.physics.shapes[F5W[28]].c = [
  1048. binaryReader.readDouble(),
  1049. binaryReader.readDouble(),
  1050. ];
  1051. F5W[74] = binaryReader.readShort();
  1052. map.physics.shapes[F5W[28]].v = [];
  1053. for (F5W[27] = 0; F5W[27] < F5W[74]; F5W[27]++) {
  1054. map.physics.shapes[F5W[28]].v.push([
  1055. binaryReader.readDouble(),
  1056. binaryReader.readDouble(),
  1057. ]);
  1058. }
  1059. }
  1060. }
  1061. F5W[71] = binaryReader.readShort();
  1062. for (F5W[17] = 0; F5W[17] < F5W[71]; F5W[17]++) {
  1063. map.physics.fixtures[F5W[17]] = { sh: 0, n: "Def Fix", fr: 0.3, fp: null, re: 0.8, de: 0.3, f: 0x4f7cac, d: false, np: false, ng: false };
  1064. map.physics.fixtures[F5W[17]].sh = binaryReader.readShort();
  1065. map.physics.fixtures[F5W[17]].n = binaryReader.readUTF();
  1066. map.physics.fixtures[F5W[17]].fr = binaryReader.readDouble();
  1067. if (map.physics.fixtures[F5W[17]].fr == Number.MAX_VALUE) {
  1068. map.physics.fixtures[F5W[17]].fr = null;
  1069. }
  1070. F5W[12] = binaryReader.readShort();
  1071. if (F5W[12] == 0) {
  1072. map.physics.fixtures[F5W[17]].fp = null;
  1073. }
  1074. if (F5W[12] == 1) {
  1075. map.physics.fixtures[F5W[17]].fp = false;
  1076. }
  1077. if (F5W[12] == 2) {
  1078. map.physics.fixtures[F5W[17]].fp = true;
  1079. }
  1080. map.physics.fixtures[F5W[17]].re = binaryReader.readDouble();
  1081. if (map.physics.fixtures[F5W[17]].re == Number.MAX_VALUE) {
  1082. map.physics.fixtures[F5W[17]].re = null;
  1083. }
  1084. map.physics.fixtures[F5W[17]].de = binaryReader.readDouble();
  1085. if (map.physics.fixtures[F5W[17]].de == Number.MAX_VALUE) {
  1086. map.physics.fixtures[F5W[17]].de = null;
  1087. }
  1088. map.physics.fixtures[F5W[17]].f = binaryReader.readUint();
  1089. map.physics.fixtures[F5W[17]].d = binaryReader.readBoolean();
  1090. map.physics.fixtures[F5W[17]].np = binaryReader.readBoolean();
  1091. if (map.v >= 11) {
  1092. map.physics.fixtures[F5W[17]].ng = binaryReader.readBoolean();
  1093. }
  1094. if (map.v >= 12) {
  1095. map.physics.fixtures[F5W[17]].ig = binaryReader.readBoolean();
  1096. }
  1097. }
  1098. F5W[63] = binaryReader.readShort();
  1099. for (F5W[52] = 0; F5W[52] < F5W[63]; F5W[52]++) {
  1100. map.physics.bodies[F5W[52]] ={ 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, fz: { on: false, x: 0, y: 0, d: true, p: true, a: true }};
  1101. map.physics.bodies[F5W[52]].type = binaryReader.readUTF();
  1102. map.physics.bodies[F5W[52]].n = binaryReader.readUTF();
  1103. map.physics.bodies[F5W[52]].p = [binaryReader.readDouble(), binaryReader.readDouble()];
  1104. map.physics.bodies[F5W[52]].a = binaryReader.readDouble();
  1105. map.physics.bodies[F5W[52]].fric = binaryReader.readDouble();
  1106. map.physics.bodies[F5W[52]].fricp = binaryReader.readBoolean();
  1107. map.physics.bodies[F5W[52]].re = binaryReader.readDouble();
  1108. map.physics.bodies[F5W[52]].de = binaryReader.readDouble();
  1109. map.physics.bodies[F5W[52]].lv = [
  1110. binaryReader.readDouble(),
  1111. binaryReader.readDouble(),
  1112. ];
  1113. map.physics.bodies[F5W[52]].av = binaryReader.readDouble();
  1114. map.physics.bodies[F5W[52]].ld = binaryReader.readDouble();
  1115. map.physics.bodies[F5W[52]].ad = binaryReader.readDouble();
  1116. map.physics.bodies[F5W[52]].fr = binaryReader.readBoolean();
  1117. map.physics.bodies[F5W[52]].bu = binaryReader.readBoolean();
  1118. map.physics.bodies[F5W[52]].cf.x = binaryReader.readDouble();
  1119. map.physics.bodies[F5W[52]].cf.y = binaryReader.readDouble();
  1120. map.physics.bodies[F5W[52]].cf.ct = binaryReader.readDouble();
  1121. map.physics.bodies[F5W[52]].cf.w = binaryReader.readBoolean();
  1122. map.physics.bodies[F5W[52]].f_c = binaryReader.readShort();
  1123. map.physics.bodies[F5W[52]].f_1 = binaryReader.readBoolean();
  1124. map.physics.bodies[F5W[52]].f_2 = binaryReader.readBoolean();
  1125. map.physics.bodies[F5W[52]].f_3 = binaryReader.readBoolean();
  1126. map.physics.bodies[F5W[52]].f_4 = binaryReader.readBoolean();
  1127. if (map.v >= 2) {
  1128. map.physics.bodies[F5W[52]].f_p = binaryReader.readBoolean();
  1129. }
  1130. if (map.v >= 14) {
  1131. map.physics.bodies[F5W[52]].fz.on = binaryReader.readBoolean();
  1132. if (map.physics.bodies[F5W[52]].fz.on) {
  1133. map.physics.bodies[F5W[52]].fz.x = binaryReader.readDouble();
  1134. map.physics.bodies[F5W[52]].fz.y = binaryReader.readDouble();
  1135. map.physics.bodies[F5W[52]].fz.d = binaryReader.readBoolean();
  1136. map.physics.bodies[F5W[52]].fz.p = binaryReader.readBoolean();
  1137. map.physics.bodies[F5W[52]].fz.a = binaryReader.readBoolean();
  1138. }
  1139. }
  1140. F5W[88] = binaryReader.readShort();
  1141. for (F5W[65] = 0; F5W[65] < F5W[88]; F5W[65]++) {
  1142. map.physics.bodies[F5W[52]].fx.push(binaryReader.readShort());
  1143. }
  1144. }
  1145. F5W[97] = binaryReader.readShort();
  1146. for (F5W[41] = 0; F5W[41] < F5W[97]; F5W[41]++) {
  1147. map.spawns[F5W[41]] = {"x":400,"y":300,"xv":0,"yv":0,"priority":5,"r":true,"f":true,"b":true,"gr":false,"ye":false,"n":"Spawn"};
  1148. F5W[35] = map.spawns[F5W[41]];
  1149. F5W[35].x = binaryReader.readDouble();
  1150. F5W[35].y = binaryReader.readDouble();
  1151. F5W[35].xv = binaryReader.readDouble();
  1152. F5W[35].yv = binaryReader.readDouble();
  1153. F5W[35].priority = binaryReader.readShort();
  1154. F5W[35].r = binaryReader.readBoolean();
  1155. F5W[35].f = binaryReader.readBoolean();
  1156. F5W[35].b = binaryReader.readBoolean();
  1157. F5W[35].gr = binaryReader.readBoolean();
  1158. F5W[35].ye = binaryReader.readBoolean();
  1159. F5W[35].n = binaryReader.readUTF();
  1160. }
  1161. F5W[16] = binaryReader.readShort();
  1162. for (F5W[25] = 0; F5W[25] < F5W[16]; F5W[25]++) {
  1163. map.capZones[F5W[25]] = {"n":"Cap Zone","ty":1,"l":10,"i":-1};
  1164. map.capZones[F5W[25]].n = binaryReader.readUTF();
  1165. map.capZones[F5W[25]].l = binaryReader.readDouble();
  1166. map.capZones[F5W[25]].i = binaryReader.readShort();
  1167. if (map.v >= 6) {
  1168. map.capZones[F5W[25]].ty = binaryReader.readShort();
  1169. }
  1170. }
  1171. F5W[98] = binaryReader.readShort();
  1172. for (F5W[19] = 0; F5W[19] < F5W[98]; F5W[19]++) {
  1173. F5W[31] = binaryReader.readShort();
  1174. if (F5W[31] == 1) {
  1175. map.physics.joints[F5W[19]] = {"type":"rv","d":{"la":0,"ua":0,"mmt":0,"ms":0,"el":false,"em":false,"cc":false,"bf":0,"dl":true},"aa":[0,0]};
  1176. F5W[20] = map.physics.joints[F5W[19]];
  1177. F5W[20].d.la = binaryReader.readDouble();
  1178. F5W[20].d.ua = binaryReader.readDouble();
  1179. F5W[20].d.mmt = binaryReader.readDouble();
  1180. F5W[20].d.ms = binaryReader.readDouble();
  1181. F5W[20].d.el = binaryReader.readBoolean();
  1182. F5W[20].d.em = binaryReader.readBoolean();
  1183. F5W[20].aa = [binaryReader.readDouble(), binaryReader.readDouble()];
  1184. }
  1185. if (F5W[31] == 2) {
  1186. map.physics.joints[F5W[19]] = {"type":"d","d":{"fh":0,"dr":0,"cc":false,"bf":0,"dl":true},"aa":[0,0],"ab":[0,0]};
  1187. F5W[87] = map.physics.joints[F5W[19]];
  1188. F5W[87].d.fh = binaryReader.readDouble();
  1189. F5W[87].d.dr = binaryReader.readDouble();
  1190. F5W[87].aa = [binaryReader.readDouble(), binaryReader.readDouble()];
  1191. F5W[87].ab = [binaryReader.readDouble(), binaryReader.readDouble()];
  1192. }
  1193. if (F5W[31] == 3) {
  1194. map.physics.joints[F5W[19]] = {"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};
  1195. F5W[90] = map.physics.joints[F5W[19]];
  1196. F5W[90].pax = binaryReader.readDouble();
  1197. F5W[90].pay = binaryReader.readDouble();
  1198. F5W[90].pa = binaryReader.readDouble();
  1199. F5W[90].pf = binaryReader.readDouble();
  1200. F5W[90].pl = binaryReader.readDouble();
  1201. F5W[90].pu = binaryReader.readDouble();
  1202. F5W[90].plen = binaryReader.readDouble();
  1203. F5W[90].pms = binaryReader.readDouble();
  1204. }
  1205. if (F5W[31] == 4) {
  1206. map.physics.joints[F5W[19]] = {"type":"lsj","d":{"cc":false,"bf":0,"dl":true},"sax":0,"say":0,"sf":0,"slen":0};
  1207. F5W[44] = map.physics.joints[F5W[19]];
  1208. F5W[44].sax = binaryReader.readDouble();
  1209. F5W[44].say = binaryReader.readDouble();
  1210. F5W[44].sf = binaryReader.readDouble();
  1211. F5W[44].slen = binaryReader.readDouble();
  1212. }
  1213. map.physics.joints[F5W[19]].ba = binaryReader.readShort();
  1214. map.physics.joints[F5W[19]].bb = binaryReader.readShort();
  1215. map.physics.joints[F5W[19]].d.cc = binaryReader.readBoolean();
  1216. map.physics.joints[F5W[19]].d.bf = binaryReader.readDouble();
  1217. map.physics.joints[F5W[19]].d.dl = binaryReader.readBoolean();
  1218. }
  1219. return map;
  1220. };
  1221. scope.updateWssLog = function(){
  1222. if(!wsslogpaused){
  1223. if(logmenutable.children.length < wsssendrecievelog.length){
  1224. var bottomscroll = logmenutable.clientHeight + logmenutable.scrollTop >= logmenutable.scrollHeight-1;
  1225. while (logmenutable.children.length>1000) {
  1226. logmenutable.removeChild(logmenutable.firstChild);
  1227. logmenutable2.removeChild(logmenutable2.firstChild);
  1228. }
  1229. var loopthro = wsssendrecievelog.slice(packetcount);
  1230. for(var i = 0; i < loopthro.length;i++){
  1231. packetcount++;
  1232. var row = document.createElement("tr");
  1233. var row2 = document.createElement("tr");
  1234.  
  1235. var cell1 = document.createElement("td");
  1236. cell1.style["overflow-x"] = "scroll";
  1237. cell1.style["padding"] = "0px";
  1238. cell1.style["width"] = "100000px";
  1239.  
  1240. var cell2 = document.createElement("td");
  1241. cell2.style["overflow-x"] = "scroll";
  1242. cell2.style["padding"] = "0px";
  1243. cell2.style["width"] = "100000px";
  1244. if(debuggercount){
  1245. cell1.style["background"] = "rgb(178, 185, 189)";
  1246. debuggercount = false;
  1247. }
  1248. else{
  1249. cell2.style["background"] = "rgb(178, 185, 189)";
  1250. debuggercount = true;
  1251. }
  1252. cell1.textContent = loopthro[i][1];
  1253. cell2.textContent = loopthro[i][1];
  1254. if(loopthro[i][0] == 0){
  1255. cell2.style["color"] = "transparent";
  1256. cell1.onclick = function(){debuggerinput.value = this.textContent};
  1257. }
  1258. else{
  1259. cell1.style["color"] = "transparent";
  1260. cell2.onclick = function(){debuggerinput.value = this.textContent};
  1261. }
  1262. row.appendChild(cell1);
  1263. row2.appendChild(cell2);
  1264. logmenutable.appendChild(row);
  1265. logmenutable2.appendChild(row2);
  1266. }
  1267. while (logmenutable.children.length>1000) {
  1268. logmenutable.removeChild(logmenutable.firstChild);
  1269. logmenutable2.removeChild(logmenutable2.firstChild);
  1270. }
  1271. if(bottomscroll){
  1272. logmenutable.scrollTop = logmenutable.scrollHeight;
  1273. logmenutable2.scrollTop = logmenutable.scrollHeight;
  1274. }
  1275. }
  1276. }
  1277. };
  1278. Gdocument.getElementById("maploadwindowmapscontainer").appendChild = function(args){
  1279.  
  1280. var checkbox = Gdocument.createElement("input");
  1281. checkbox.type = "checkbox";
  1282. checkbox.style["position"]="absolute";
  1283. checkbox.style["margin-top"] = "135px";
  1284. checkbox.style["margin-left"] = "140px";
  1285. checkbox.style["scale"] = "2";
  1286. checkbox.style["display"] = "none";
  1287. checkbox.className = "quickplaycheckbox quickplayunchecked";
  1288. if(ishost && stopquickplay==0){
  1289. checkbox.style["display"] = "block";
  1290. checkbox.className = "quickplaycheckbox quickplaychecked";
  1291. }
  1292. checkbox.checked = true;
  1293. checkbox.onclick = function(e){e.stopPropagation();};
  1294. args.appendChild(checkbox);
  1295. originalMapLoad.call(this,args);
  1296. };
  1297. Gdocument.getElementById("newbonklobby_chat_content").appendChild = function(args){
  1298. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  1299. if(args.children[0].textContent.endsWith(" has left the game ") && args.children[0].textContent.startsWith("* ")){
  1300. var kickedorbanned = "banned";
  1301. if(onlykicked){
  1302. kickedorbanned = "kicked";
  1303. }
  1304. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been "+kickedorbanned+" from the game ";
  1305. }
  1306. }
  1307. setTimeout(function(){
  1308. if(args.textContent.startsWith("* ") && args.children.length>=5){
  1309. var newarg = args.cloneNode();
  1310. for(var i = 0;i<args.children.length;i++){
  1311. var newarg2 = args.children[i].cloneNode();
  1312. newarg2.textContent = args.children[i].textContent;
  1313. newarg2.style.color = '#ffffffd6';
  1314. newarg2.onclick = args.children[i].onclick;
  1315. newarg2.suggestID = args.children[i].suggestID;
  1316. newarg.appendChild(newarg2);
  1317. }
  1318. Gdocument.getElementById("ingamechatcontent").appendChild(newarg);
  1319. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  1320. }},0);
  1321. originalLobbyChat.call(this,args);
  1322. };
  1323. Gdocument.getElementById("ingamechatcontent").appendChild = function(args){
  1324. if(beenKickedTimeStamp+100>Date.now() && args.children.length>0){
  1325. if(args.children[0].textContent.endsWith(" has left the game.") && args.children[0].textContent.startsWith("* ")){
  1326. var kickedorbanned = "banned";
  1327. if(onlykicked){
  1328. kickedorbanned = "kicked";
  1329. }
  1330. args.children[0].textContent = args.children[0].textContent.substring(0,args.children[0].textContent.length-19)+" has been "+kickedorbanned+" from the game.";
  1331. }
  1332. }
  1333. if(recordedTimeStamp+100>Date.now() && args.children.length>0){
  1334. if(args.children[0].textContent.includes("seconds") && args.children[0].textContent.startsWith("* ")){
  1335. args.children[0].textContent = args.children[0].textContent + " - " + playerids[recordedId].userName;
  1336. }
  1337. }
  1338. originalIngameChat.call(this,args);
  1339. };
  1340. Gwindow.Date.now = function(){
  1341. if(overideDate[0]){
  1342. /*console.log(overideDate[1])*/
  1343. return overideDate[1];
  1344. }
  1345. else if(causelag){
  1346. return originalDatenow.call(this,...arguments)-causelag2;
  1347. }
  1348. return originalDatenow.call(this,...arguments);
  1349. };
  1350. Gwindow.XMLHttpRequest.prototype.open = function(_, url) {
  1351. if (url.includes("scripts/map_get") || url.includes("scripts/map_b1_get") || url.includes("scripts/hotmaps/")) {
  1352. if(searchrequested==1){
  1353. Gdocument.getElementById("maploadtypedropdowntitle").click();
  1354. Gdocument.getElementById("maploadtypedropdowntitle").textContent = dropdownrequested.textContent;
  1355. dropdownrequested.style["display"] = "none";
  1356. clearmaprequests.style["display"] = "block";
  1357. refreshmaprequests.style["display"] = "block";
  1358. Gdocument.getElementById("maploadwindowhotnessslider").style["visibility"] = "hidden";
  1359. Gdocument.getElementById("maploadwindowsearchoptions").style["visibility"] = "hidden";
  1360. searchrequested = 0;
  1361. this.isSearchMap = true;
  1362. }
  1363. }
  1364. else if(url.includes("getrooms.php")){
  1365. this.isGetRooms = true;
  1366. }
  1367. else if(url.includes("getroomaddress.php")){
  1368. this.isGetRoomAddress = true;
  1369. }
  1370. originalXMLOpen.call(this, ...arguments);
  1371. };
  1372. Gwindow.XMLHttpRequest.prototype.send = function(data) {
  1373. if(this.isGetRoomAddress){
  1374. currentroomaddress = parseInt(data.slice(3));
  1375. }
  1376. else if(this.isGetRooms && inroom){
  1377. this.onreadystatechange = function(){
  1378. if(this.readyState == 4){
  1379. lastrooms = JSON.parse(this.response)["rooms"];
  1380. if(lastrooms){
  1381. var keys = Object.keys(savedroomsdata);
  1382. for(var i = 0;i<lastrooms.length;i++){
  1383. if(savedrooms.includes(lastrooms[i].id)){
  1384. exists = true;
  1385. savedroomsdata[lastrooms[i].id] = lastrooms[i];
  1386. savedroomsdata[lastrooms[i].id].exists = true;
  1387. savedroomsdata[lastrooms[i].id].exists2 = true;
  1388. if(lastrooms[i].maxplayers>lastrooms[i].players){
  1389. if(inroom){
  1390. if(lastrooms[i].id!=currentroomaddress){
  1391. displayInChat('The room '+JSON.stringify(lastrooms[i].roomname)+' is now open with '+lastrooms[i].players+"/"+lastrooms[i].maxplayers+" players.","#DA0808","#1EBCC1");
  1392. savedrooms.splice(savedrooms.indexOf(lastrooms[i].id),1);
  1393. delete savedroomsdata[lastrooms[i].id];
  1394. keys.splice(keys.indexOf((lastrooms[i].id).toString()),1);
  1395. }
  1396. else{
  1397. savedrooms.splice(savedrooms.indexOf(lastrooms[i].id),1);
  1398. delete savedroomsdata[lastrooms[i].id];
  1399. keys.splice(keys.indexOf((lastrooms[i].id).toString()),1);
  1400. }
  1401. }
  1402. }
  1403. }
  1404. }
  1405. for(var i = 0;i<keys.length;i++){
  1406. if(!savedroomsdata[keys[i]].exists2){
  1407. savedroomsdata[keys[i]].exists = false;
  1408. }
  1409. savedroomsdata[keys[i]].exists2 = false;
  1410. }
  1411. for(var i = 0;i<keys.length;i++){
  1412. if(!savedroomsdata[keys[i]].exists){
  1413. savedrooms.splice(savedrooms.indexOf(parseInt(keys[i])),1);
  1414. displayInChat('The room '+JSON.stringify(savedroomsdata[keys[i]].roomname)+" does not exist anymore.","#DA0808","#1EBCC1");
  1415. delete savedroomsdata[keys[i]];
  1416. }
  1417. }
  1418. }
  1419. }
  1420. }
  1421. }
  1422. else if (this.isSearchMap) {
  1423. this.onreadystatechange = function () {
  1424. if (this.readyState == 4){
  1425. var jsonargs = {r:"success",maps:[],more:true};
  1426. for(var i = 0; i<requestedmaps.length; i++){
  1427. var dec = requestedmaps[i][0];
  1428. var undec = requestedmaps[i][1];
  1429. var map = {};
  1430. map.id = dec["m"]["dbid"];
  1431. map.name = dec["m"]["n"];
  1432. map.authorname = dec["m"]["a"];
  1433. map.leveldata = undec;
  1434. map.publisheddate = dec["m"]["date"];
  1435. map.remixauthor = dec["m"]["rxa"];
  1436. map.remixdb = dec["m"]["rxdb"];
  1437. map.remixid = dec["m"]["rxid"];
  1438. map.remixname = dec["m"]["rxn"];
  1439. map.vd = dec["m"]["vd"];
  1440. map.vu = dec["m"]["vu"];
  1441. jsonargs.maps.push(map);
  1442. }
  1443. jsonargs2 = JSON.stringify(jsonargs);
  1444. function stringifyjsonargs(){
  1445. return jsonargs2;
  1446. }
  1447. this.__defineGetter__("responseText", stringifyjsonargs);
  1448. this.__defineGetter__("response", stringifyjsonargs);
  1449. }
  1450. }
  1451. }
  1452. originalXMLSend.call(this, ...arguments);
  1453. };
  1454. scope.STB = function(x){
  1455. if(x == "0"){
  1456. return 0;
  1457. }
  1458. else{
  1459. return 1;
  1460. }
  1461. };
  1462. scope.BTS = function(x){
  1463. if(x == 0){
  1464. return "0";
  1465. }
  1466. else{
  1467. return "1";
  1468. }
  1469. };
  1470. scope.GET_KEYS = function(x){
  1471. var x2 = ((x+64)>>>0).toString(2).substring(1).split("");
  1472. 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])}
  1473. };
  1474. scope.MAKE_KEYS = function(x){
  1475. return x.special*32+x.heavy*16+x.down*8+x.up*4+x.right*2+x.left
  1476. };
  1477.  
  1478. Gwindow.PIXI.Graphics.prototype.drawCircle = function(...args){
  1479. var This = this;
  1480. var Args = [...args];
  1481. setTimeout(function(){
  1482. if(This.parent){
  1483. var childs = This.parent.children;
  1484. var user = 0;
  1485. for(var i = 0;i<childs.length;i++){
  1486. if(childs[i]._text){
  1487. user = childs[i]._text;
  1488. }
  1489. if(i==2 && childs[i]!=This){
  1490. return;
  1491. }
  1492. }
  1493. var keys = Object.keys(playerids);
  1494. for(var i = 0;i<keys.length;i++){
  1495. if(playerids[keys[i]].userName == user){
  1496. playerids[keys[i]].playerData = This.parent;
  1497. if(!playerids[keys[i]].playerData2){
  1498. playerids[keys[i]].playerData2 = {alive:true,radius:12,timeStamp:0,timeStamp2:0,px:0,py:0,pvx:0,pvy:0,xacc:0,yacc:0,xvel:0,yvel:0,balance:0};
  1499. }
  1500. playerids[keys[i]].playerData2.radius = Args[2];
  1501. parentDraw = This.parent;
  1502. while(parentDraw.parent){
  1503. parentDraw = parentDraw.parent;
  1504. }
  1505. }
  1506. }
  1507. }
  1508. },0);
  1509. return originalDrawCircle.call(this,...args);
  1510. };
  1511. Gwindow.requestAnimationFrame = function(...args){
  1512. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  1513. while(parentDraw.parent){
  1514. parentDraw = parentDraw.parent;
  1515. }
  1516. var canv = 0;
  1517. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  1518. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  1519. canv = Gdocument.getElementById("gamerenderer").children[i];
  1520. break;
  1521. }
  1522. }
  1523. var width = parseInt(canv.style["width"]);
  1524. var height = parseInt(canv.style["height"]);
  1525. scale = (parseInt(canv.style["width"])/730);
  1526. var now = Date.now();
  1527. var keys = Object.keys(playerids);
  1528. addto = {"children":[]};
  1529. for(var i = 0;i<parentDraw.children.length;i++){
  1530. if(parentDraw.children[i].constructor.name == "e"){
  1531. addto = parentDraw.children[i];
  1532. break;
  1533. }
  1534. }
  1535. if(autocam){
  1536. var autocamx = 365*scale;
  1537. var autocamy = 250*scale;
  1538. if(FollowCam && playerids[myid].playerData?.transform){
  1539. autocamx = playerids[myid].playerData.transform.position.x;
  1540. autocamy = playerids[myid].playerData.transform.position.y;
  1541. }
  1542. var distances = {};
  1543. for(var i = 0;i<keys.length;i++){
  1544. if(playerids[keys[i]].playerData && playerids[keys[i]].playerData2){
  1545. if(playerids[keys[i]].playerData.transform){
  1546. var ypos = playerids[keys[i]].playerData.transform.position.y;
  1547. if(ypos>460*scale && ypos< 500 * scale){
  1548. ypos = scale * 460;
  1549. }
  1550. distances[keys[i]] = [playerids[keys[i]].playerData.transform.position.x-autocamx,ypos-autocamy];
  1551. }
  1552. }
  1553. }
  1554. distances["topleft"] = [autocamx-40,autocamy-40];
  1555. distances["topright"] = [690*scale-autocamx,autocamy-40];
  1556. distances["bottomleft"] = [autocamx-40,460*scale-autocamy];
  1557. distances["bottomright"] = [690*scale-autocamx,460*scale-autocamy];
  1558. var lowestD = [-1,-1];
  1559. var keys2 = Object.keys(distances);
  1560. for(var i = 0;i<keys2.length;i++){
  1561. if(Math.abs(distances[keys2[i]][0]/scale)>lowestD[0]){
  1562. lowestD[0] = Math.abs(distances[keys2[i]][0]/scale);
  1563. }
  1564. if(Math.abs(distances[keys2[i]][1]/scale)>lowestD[1]){
  1565. lowestD[1] = Math.abs(distances[keys2[i]][1]/scale);
  1566. }
  1567. }
  1568. var horizontal = (lowestD[0])/345;
  1569. var vertical = (lowestD[1])/230;
  1570. newzoom = Math.min(Math.abs(1/Math.max(horizontal,vertical)),1);
  1571. }
  1572. else{
  1573. newzoom = 1;
  1574. }
  1575.  
  1576. newzoom2 = newzoom2 + 0.15*(newzoom-newzoom2);
  1577. zoom2 = zoom2 + 0.15*(zoom-zoom2);
  1578. addto.scale.x = newzoom2 * zoom2;
  1579. addto.scale.y = newzoom2 * zoom2;
  1580. if(holdheavy>0){
  1581. if(holdheavy==1){
  1582. holdheavy = -1;
  1583. }
  1584. else{
  1585. holdheavy-=1;
  1586. }
  1587. }
  1588. if(playerids[myid].playerData?.children){
  1589. for(var i = 0;i<playerids[myid].playerData.children.length;i++){
  1590. if(playerids[myid].playerData.children[i].alpha!=1){
  1591. heavyid = i;
  1592. }
  1593. if(playerids[myid].playerData.children[i].vertextData){
  1594. if(playerids[myid].playerData.children[i].vertextData.length == 0){
  1595. specialid = i;
  1596. }
  1597. }
  1598. }
  1599. }
  1600. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  1601. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  1602. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  1603. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  1604. if(canvasWidth!=width){
  1605. canvasWidth = width;
  1606. pixiCircle.clear();
  1607. pixiCircle.x = parseInt(canv.style["width"])/2;
  1608. pixiCircle.y = parseInt(canv.style["height"])/2;
  1609. pixiCircle.lineStyle(3, 0x8B8000);
  1610. pixiCircle.drawRect(-parseInt(canv.style["width"])/2,-parseInt(canv.style["height"])/2,parseInt(canv.style["width"]),parseInt(canv.style["height"]));
  1611. pixiCircle.lineStyle(3, 0xFF0000);
  1612. pixiCircle.arc(0, 0, 850*scale,Math.atan2(250,-100*Math.sqrt(66)),Math.atan2(250,100*Math.sqrt(66)));
  1613. pixiCircle.lineTo(-100*Math.sqrt(66)*scale,250*scale);
  1614. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  1615. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  1616. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  1617. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  1618. }
  1619.  
  1620. if(!addto.children.includes(container)){
  1621. addto.addChild(container);
  1622. }
  1623. if(keys.length>0){
  1624. if(playerids[myid].playerData && playerids[myid].playerData2){
  1625. if(aimbot || heavybot || staystill){
  1626. var targetid = -1;
  1627. var distances = {};
  1628. if(Gdocument.getElementById("ingamecountdown").style["visibility"] == "hidden"){
  1629. if(playerids[myid].playerData.transform){
  1630. var teamok = true;
  1631. if(playerids[myid].team>1){
  1632. teamok = false;
  1633. }
  1634. for(var i = 0;i<keys.length;i++){
  1635. if(playerids[keys[i]].playerData && playerids[keys[i]].playerData2 && keys[i]!=myid){
  1636. if(playerids[keys[i]].playerData.transform && (playerids[keys[i]].team != playerids[myid].team || teamok || FFA)){
  1637. distances[keys[i]] = Math.sqrt((playerids[keys[i]].playerData.transform.position.x-playerids[myid].playerData.transform.position.x)**2+(playerids[keys[i]].playerData.transform.position.y-playerids[myid].playerData.transform.position.y)**2);
  1638. }
  1639. }
  1640. }
  1641. }
  1642. }
  1643. var lowestD = [-1,-1];
  1644. var keys2 = Object.keys(distances);
  1645. for(var i = 0;i<keys2.length;i++){
  1646. if(myid != keys2[i]){
  1647. if(lowestD[1] == -1){
  1648. lowestD[1] = distances[keys2[i]];
  1649. lowestD[0] = keys2[i];
  1650. }
  1651. else if(distances[keys2[i]]<lowestD[1]){
  1652. lowestD[1] = distances[keys2[i]];
  1653. lowestD[0] = keys2[i];
  1654. }
  1655. }
  1656. }
  1657. targetid = lowestD[0];
  1658. if(playerids[myid].playerData?.transform && playerids[myid].playerData2){
  1659. if(staystill & staystillpos[0]!=null){
  1660. var playerpos = playerids[myid].playerData.transform.position;
  1661. if(staystillpos[0]+2<playerpos.x/scale || playerids[myid].playerData2.xvel/scale>0){
  1662. fire("keydown",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1663. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1664. }
  1665. else if(staystillpos[0]-2>playerpos.x/scale || playerids[myid].playerData2.xvel/scale<0){
  1666. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1667. fire("keydown",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1668. }
  1669. else{
  1670. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1671. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1672. }
  1673. }
  1674. }
  1675. if(targetid != -1 && playerids[myid].playerData?.transform){
  1676. if(playerids[myid].playerData.children.length >= 7 && playerids[targetid].playerData && playerids[targetid].playerData.transform && playerids[targetid].playerData2 && aimbot){
  1677. var indexE = -1;
  1678. for(var i = 0;i<playerids[myid].playerData.children.length;i++){
  1679. if(playerids[myid].playerData.children[i].constructor.name == "e"){
  1680. indexE = i;
  1681. break;
  1682. }
  1683. }
  1684. if(indexE != -1 && playerids[myid].playerData.children[indexE].visible){
  1685. if(started == 0){
  1686. started = now;
  1687. }
  1688. var scale2=1/(parseInt(canv.style["width"])/730);
  1689. scale2 /= scale/(1 + playerids[myid].playerData2.balance*0.0088)*(playerids[myid].playerData2.radius/12);
  1690. var Dstarted = (Math.min((now-started)/1000,10/3)/(10/3));
  1691. var v = multiplier * (Dstarted*100+15)*scale2;
  1692. var g = gravity;
  1693. var mypos = playerids[myid].playerData.transform.position;
  1694. var targetpos = playerids[targetid].playerData.transform.position;
  1695. var deltapos = [(targetpos.x-mypos.x)*scale2,(targetpos.y-mypos.y)*scale2];
  1696. var dis = (Math.sqrt(deltapos[0]**2 + deltapos[1]**2))/v*prediction;
  1697. deltapos[0]+=(playerids[targetid].playerData2.xvel*scale2*dis+(playerids[targetid].playerData2.xacc*scale2*(dis))**2/2);
  1698. deltapos[1]+=(playerids[targetid].playerData2.yvel*scale2*dis+(playerids[targetid].playerData2.yacc*scale2*(dis))**2/2);
  1699. deltapos[1] = -deltapos[1];
  1700. var angle = positive(-Math.atan2(deltapos[1],deltapos[0]));
  1701. var rot = playerids[myid].playerData.children[indexE].transform.rotation;
  1702. rot = positive(rot);
  1703. angle = positive(angle);
  1704.  
  1705. var alpha = deltapos[0];
  1706. var beta = deltapos[1];
  1707. var v_squared = v**2;
  1708. var eff = 2*v_squared/g;
  1709. var rootterm = eff*(eff-2*beta)-2*alpha**2;
  1710. if(rootterm < 0) {
  1711. } else {
  1712. gamma_first = (eff + Math.sqrt(rootterm));
  1713. gamma_second = (eff - Math.sqrt(rootterm));
  1714. theta_first = positive(-Math.atan2(gamma_first, alpha));
  1715. theta_second = positive(-Math.atan2(gamma_second, alpha));
  1716. if(angle_between(angle,theta_first)<angle_between(angle,theta_second)){
  1717. angle = theta_first;
  1718. }
  1719. else{
  1720. angle = theta_second;
  1721. }
  1722. }
  1723. var min = angle_between(angle,rot);
  1724. if(angle_between2(angle,rot)<0){
  1725. fire("keydown",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1726. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1727. }
  1728. else{
  1729. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1730. fire("keydown",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1731. }
  1732. if(min<0.05){
  1733. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1734. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1735. }
  1736. }
  1737. else if(started>0){
  1738. started = 0;
  1739. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  1740. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  1741. }
  1742. }
  1743. }
  1744. if(playerids[myid].playerData?.transform && heavybot && mode!="f" && mode!="bs"){
  1745. var myradius = playerids[myid].playerData2.radius / scale;
  1746. var mypos = playerids[myid].playerData.transform.position;
  1747. var breakout = false;
  1748. for(var i = 0;i<keys2.length;i++){
  1749. var targetradius = playerids[keys2[i]].playerData2.radius / scale;
  1750. var targetpos = playerids[keys2[i]].playerData.transform.position;
  1751. var deltapos = [(targetpos.x-mypos.x)/scale,(targetpos.y-mypos.y)/scale];
  1752. for(var i2 = 0;i2<160;i2++){
  1753. deltapos2 = [...deltapos];
  1754. var i3 = i2*0.5;
  1755. deltapos2[0]+=((playerids[keys2[i]].playerData2.xvel-playerids[myid].playerData2.xvel)/scale*i3);
  1756. deltapos2[1]+=((playerids[keys2[i]].playerData2.yvel-playerids[myid].playerData2.yvel)/scale*i3);
  1757. var dis = Math.sqrt(deltapos2[0]**2+deltapos2[1]**2);
  1758. if(dis<myradius+targetradius){
  1759. breakout = true;
  1760. holdheavy = 20;
  1761. break;
  1762. }
  1763. }
  1764. if(breakout){
  1765. break;
  1766. }
  1767. }
  1768. if(holdheavy>0){
  1769. if(!heavyheld2){
  1770. heavyheld = playerids[myid].playerData.children[heavyid].alpha>0;
  1771. }
  1772. fire("keydown",{"keyCode":heavy},Gdocument.getElementById("gamerenderer"));
  1773. heavyheld2 = true;
  1774. if(mode == "sp"){
  1775. if(!grappleheld2){
  1776. grappleheld = playerids[myid].playerData.children[specialid].vertexData?.length>0;
  1777. }
  1778. if(grappleheld){
  1779. fire("keyup",{"keyCode":special},Gdocument.getElementById("gamerenderer"));
  1780. }
  1781. grappleheld2 = true;
  1782. }
  1783. }
  1784. else if(holdheavy<0){
  1785. holdheavy = 0;
  1786. heavyheld2 = false;
  1787. grappleheld2 = false;
  1788. if(!heavyheld){
  1789. heavyheld = false;
  1790. fire("keyup",{"keyCode":heavy},Gdocument.getElementById("gamerenderer"));
  1791. }
  1792. if(grappleheld && mode == "sp"){
  1793. grappleheld = false;
  1794. fire("keydown",{"keyCode":special},Gdocument.getElementById("gamerenderer"));
  1795. }
  1796. }
  1797. else{
  1798. heavyheld2 = false;
  1799. heavyheld = false;
  1800. grappleheld2 = false;
  1801. grappleheld = false;
  1802. }
  1803. }
  1804.  
  1805. }
  1806. if(FollowCam){
  1807. if(playerids[myid].playerData?.transform){
  1808.  
  1809. pixiCircle.visible = true;
  1810.  
  1811. parentDraw.x = -playerids[myid].playerData.x*addto.scale.x+parseInt(width)/2;
  1812. parentDraw.y = -playerids[myid].playerData.y*addto.scale.y+parseInt(height)/2;
  1813. parentDraw.children[0].x = playerids[myid].playerData.x*addto.scale.x-parseInt(width)/2;
  1814. parentDraw.children[0].y = playerids[myid].playerData.y*addto.scale.y-parseInt(height)/2;
  1815. }
  1816. else{
  1817. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  1818. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  1819. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  1820. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  1821. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999){
  1822. pixiCircle.visible = false;
  1823. }
  1824. else{
  1825. pixiCircle.visible = true;
  1826. }
  1827. }
  1828. }
  1829. }
  1830. }
  1831. if(!FollowCam){
  1832. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999){
  1833. pixiCircle.visible = false;
  1834. }
  1835. else{
  1836. pixiCircle.visible = true;
  1837. }
  1838. }
  1839. }
  1840. return requestAnimationFrameOriginal.call(this,...args);
  1841. };
  1842. scope.SENDFUNCTION = function(args){return args;};
  1843. scope.RECIEVEFUNCTION = function(args){return args;};
  1844. scope.EVENTLOOPFUNCTION = function(){};
  1845.  
  1846. Gwindow.WebSocket.prototype.send = function(args) {
  1847. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=")){
  1848. if(typeof(args) == "string" && !bonkwssextra.includes(this)){
  1849. args = SENDFUNCTION(args);
  1850. wsssendlog.push(args);
  1851. wsssendrecievelog.push([0,args]);
  1852. if(!bonkwss){
  1853. bonkwss = this;
  1854. }
  1855. if(args.startsWith('42[26,')){
  1856. var jsonargs = JSON.parse(args.substring(2));
  1857. if(sandboxon){
  1858. if(typeof(sandboxplayerids[jsonargs[1]["targetID"]])!='undefined'){
  1859. var packet = '42[18,'+jsonargs[1]["targetID"]+','+jsonargs[1]["targetTeam"]+']';
  1860. RECIEVE(packet);
  1861. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet],to:[-1]}]));
  1862. }
  1863. }
  1864. }
  1865. if(args.startsWith('42[9,')){
  1866. var jsonargs = JSON.parse(args.substring(2));
  1867. if(sandboxon){
  1868. if(typeof(sandboxplayerids[jsonargs[1]["banshortid"]])!='undefined'){
  1869. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden"){
  1870. var packet = '42[24,'+jsonargs[1]["banshortid"].toString()+','+jsonargs[1]["kickonly"]+']';
  1871. var packet2 = '42[5,'+jsonargs[1]["banshortid"].toString()+',0]';
  1872. RECIEVE(packet);
  1873. RECIEVE(packet2);
  1874. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet,packet2],to:[-1]}]));
  1875. }
  1876. else{
  1877. displayInChat("Cannot delete players while ingame.","#DA0808","#1EBCC1");
  1878. }
  1879. }
  1880. }
  1881. }
  1882. if(args.startsWith('42[1,')){
  1883. return;
  1884. }
  1885.  
  1886. if(args.startsWith('42[4,')){
  1887. var jsonargs = JSON.parse(args.substring(2));
  1888. if(sandboxcopyme==myid && typeof(jsonargs[1]["i"])!="undefined"){
  1889. var jsonkeys = Object.keys(sandboxplayerids);
  1890. var jsonargs2 = jsonargs[1];
  1891. for(var i = 0; i<jsonkeys.length;i++){
  1892. jsonargs2["c"] = playerids[jsonkeys[i]].movecount;
  1893. var packet = '42[7,'+jsonkeys[i].toString()+','+JSON.stringify(jsonargs2)+']';
  1894. RECIEVE(packet);
  1895. }
  1896. jsonargs2["c"] = "CVALUE";
  1897. jsonargs2 = JSON.stringify(jsonargs2).replace('"CVALUE"',"CVALUE");
  1898. SEND("42"+JSON.stringify([4,{"type":"customfakerecieve","from":username,"packet":['42[7,ID,'+jsonargs2+']'],to:[-1]}]));
  1899. }
  1900. if(recording && typeof(jsonargs[1]["i"])!="undefined"){
  1901. if(myid.toString() == recordingid){
  1902. if(recordingdata.length == 0){
  1903. recordingdata.push([jsonargs[1]["i"],jsonargs[1]["f"]]);
  1904. }
  1905. else{
  1906. recordingdata.push([jsonargs[1]["i"],jsonargs[1]["f"]-recordingdata[0][1]]);
  1907. }
  1908. }
  1909. }
  1910. playerids[myid].lastmove = Date.now();
  1911. if(ishost && typeof(jsonargs[1]["i"])!="undefined"){
  1912. for(var i = 0;i<disabledkeys.length;i++){
  1913. if(GET_KEYS(jsonargs[1]["i"])[disabledkeys[i]]){
  1914. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden" && !killedids.includes(myid)){
  1915. killedids.push(myid);
  1916. currentFrame = Math.floor((Date.now() - gameStartTimeStamp)/1000*30);
  1917. SEND('42[25,{"a":{"playersLeft":['+myid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  1918. RECIEVE('42[31,{"a":{"playersLeft":['+myid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  1919. break;
  1920. }
  1921. }
  1922. }
  1923. }
  1924. }
  1925. if(args.startsWith('42[29,')){
  1926. var jsonargs = JSON.parse(args.substring(2));
  1927. playerids[jsonargs[1]["sid"]].playerData2.balance = jsonargs[1]["bal"];
  1928. if(sandboxon){
  1929. if(typeof(sandboxplayerids[jsonargs[1]["sid"]])!='undefined'){
  1930. var packet = '42[36,'+jsonargs[1]["sid"]+','+jsonargs[1]["bal"]+']';
  1931. RECIEVE(packet);
  1932. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet],to:[-1]}]));
  1933. }
  1934. }
  1935. }
  1936. if(args.startsWith('42[12,')){
  1937. playerids = {};
  1938. var jsonargs2 = JSON.parse(args.substring(2));
  1939. var jsonargs = jsonargs2[1];
  1940. playerids["0"] = {"peerID":jsonargs["peerID"],"userName":username,"level":Gdocument.getElementById("pretty_top_level").textContent == "Guest" ? 0 : parseInt(Gdocument.getElementById("pretty_top_level").textContent.substring(3)),"guest":typeof(jsonargs.token)=="undefined","team":1,"avatar":jsonargs["avatar"],"movecount":0,"commands":true,"ratelimit":{"pm":0,"mode":0,"team":0,"poll":0,"join":Date.now()},"vote":{"poll":-1}};
  1941. myid = 0;
  1942. bonkwss = this;
  1943. hostid = 0;
  1944. inroom = true;
  1945. if(savedrooms.length>0){
  1946. Gdocument.getElementById("roomlistrefreshbutton").click();
  1947. }
  1948. }
  1949. if(args.startsWith('42[23,') && recteams){
  1950. var jsonargs = JSON.parse(args.substring(2));
  1951. var map = decodeFromDatabase(jsonargs[1]["m"]);
  1952. var spawns = map["spawns"];
  1953. var teamsneeded = true;
  1954. var excludedindexes = [];
  1955. var ffaspawns = false;
  1956. var ffaforsure = false;
  1957. for(var i = 0; i<spawns.length;i++){
  1958. var currentSpawn = spawns[i];
  1959. if(Math.sqrt(currentSpawn.x**2 + currentSpawn.y**2)>=850 || currentSpawn.y>250){
  1960. excludedindexes.push(i);
  1961. }
  1962. else if(!(currentSpawn.f || currentSpawn.r || currentSpawn.b || currentSpawn.gr || currentSpawn.ye)){
  1963. excludedindexes.push(i);
  1964. }
  1965. else if(currentSpawn.f){
  1966. ffaspawns = true;
  1967. if(!(currentSpawn.r || currentSpawn.b || currentSpawn.gr || currentSpawn.ye)){
  1968. excludedindexes.push(i);
  1969. ffaforsure = true
  1970. }
  1971. }
  1972. }
  1973. if(!ffaspawns && !ffaforsure){
  1974. teamsneeded = true;
  1975. }
  1976. else{
  1977. teamsneeded = false;
  1978. }
  1979. if(teamsneeded){
  1980. var newspawns = [];
  1981. for(var i = 0; i<spawns.length;i++){
  1982. if(!excludedindexes.includes(i)){
  1983. 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"]});
  1984. }
  1985. }
  1986. if(newspawns.length>0){
  1987. var teamletters = ["r","g","b","y"];
  1988. var ratios = {"r":0,"g":0,"b":0,"y":0};
  1989. for(var i = 0; i < newspawns.length;i++){
  1990. for(var i2 = 0; i2<teamletters.length;i2++){
  1991. var ct = teamletters[i2];
  1992. if(newspawns[i]["priority"]!=0){
  1993. ratios[ct]+=(newspawns[i][ct])/newspawns[i]["total"]*newspawns[i]["priority"];
  1994. }
  1995. }
  1996. }
  1997. var highest = ["",0];
  1998. for(var i = 0; i<teamletters.length;i++){
  1999. var ct = teamletters[i];
  2000. if(ratios[ct]>0 && highest[1]<ratios[ct]){
  2001. highest = [ct,ratios[ct]];
  2002. }
  2003. }
  2004. if(highest[0]!=""){
  2005. for(var i = 0; i<teamletters.length;i++){
  2006. var ct = teamletters[i];
  2007. ratios[ct] = ratios[ct]/highest[1];
  2008. }
  2009. }
  2010. var playerids3 = Object.keys(playerids);
  2011. var playerids2 = [];
  2012. for(var i = 0; i<playerids3.length;i++){
  2013. if(playerids[playerids3[i]].team>0){
  2014. playerids2.push(playerids3[i]);
  2015. }
  2016. }
  2017. var pi2l = playerids2.length;
  2018. var ratios2 = {"r":0,"r1":0,"g":0,"g1":0,"b":0,"b1":0,"y":0,"y1":0};
  2019. var items = Object.entries(ratios);
  2020. items.sort(function(a,b){return a[1]-b[1];});
  2021. var items = items.map(function(e){return e[0];});
  2022. var highest2 = ["",0];
  2023. while(pi2l>0){
  2024. var done = false;
  2025. for(var i2 = 0; i2<items.length;i2++){
  2026. var ci = items[i2];
  2027. var ci2 = items[i2]+"1";
  2028. for(var i = 0; i<teamletters.length;i++){
  2029. var ct = teamletters[i];
  2030. if(ratios2[ct]>0 && highest2[1]<ratios2[ct]){
  2031. highest2 = [ct,ratios2[ct]];
  2032. }
  2033. }
  2034. if(highest2[0]!=""){
  2035. for(var i = 0; i<teamletters.length;i++){
  2036. var ct = teamletters[i];
  2037. ratios2[ct+"1"] = ratios2[ct]/highest2[1];
  2038. }
  2039. }
  2040. if(ratios[ci]>0 && ratios[ci]>=ratios2[ci2] && pi2l>0){
  2041. ratios2[ci]+=1;
  2042. pi2l--;
  2043. done = true;
  2044. }
  2045. }
  2046. if(pi2l>0 && !done){
  2047. ratios2[highest2[0]]+=1;
  2048. pi2l--;
  2049. }
  2050. }
  2051. SEND('42[32,{"t":true}]');
  2052. RECIEVE('42[39,true]');
  2053. for(var i = 0; i<ratios2["r"];i++){
  2054. var pid = playerids2.splice(Math.floor(Math.random()*playerids2.length),1)[0];
  2055. SEND('42[26,{"targetID":'+pid+',"targetTeam":2}]');
  2056. if(playerids[pid].peerID!="sandbox"){
  2057. RECIEVE('42[18,'+pid+',2]');
  2058. }
  2059. }
  2060. for(var i = 0; i<ratios2["g"];i++){
  2061. var pid = playerids2.splice(Math.floor(Math.random()*playerids2.length),1)[0];
  2062. SEND('42[26,{"targetID":'+pid+',"targetTeam":4}]');
  2063. if(playerids[pid].peerID!="sandbox"){
  2064. RECIEVE('42[18,'+pid+',4]');
  2065. }
  2066. }
  2067. for(var i = 0; i<ratios2["b"];i++){
  2068. var pid = playerids2.splice(Math.floor(Math.random()*playerids2.length),1)[0];
  2069. SEND('42[26,{"targetID":'+pid+',"targetTeam":3}]');
  2070. if(playerids[pid].peerID!="sandbox"){
  2071. RECIEVE('42[18,'+pid+',3]');
  2072. }
  2073. }
  2074. for(var i = 0; i<ratios2["y"];i++){
  2075. var pid = playerids2.splice(Math.floor(Math.random()*playerids2.length),1)[0];
  2076. SEND('42[26,{"targetID":'+pid+',"targetTeam":5}]');
  2077. if(playerids[pid].peerID!="sandbox"){
  2078. RECIEVE('42[18,'+pid+',5]');
  2079. }
  2080. }
  2081. }
  2082. }
  2083. else{
  2084. SEND('42[32,{"t":false}]');
  2085. RECIEVE('42[39,false]');
  2086. }
  2087. }
  2088.  
  2089. if(args.startsWith('42[47,') && stopquickplay == 0 && ishost && document.hidden && !qppaused){
  2090. roundsperqp2++;
  2091. if(roundsperqp2>=roundsperqp){
  2092. if(shuffle){
  2093. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2094. var available = [];
  2095. var availableindexes = [];
  2096. var notempty = false;
  2097. for(var i = 0; i<e2.length;i++){
  2098. var a = false;
  2099. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2100. available.push(a);
  2101. if(a){
  2102. availableindexes.push(i);
  2103. notempty = true;
  2104. }
  2105. }
  2106. if(notempty){
  2107.  
  2108. if(availableindexes.length!=1){
  2109. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  2110. }
  2111. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  2112. }
  2113. }
  2114. else{
  2115. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  2116. var available = [];
  2117. var availableindexes = [];
  2118. var notempty = false;
  2119. for(var i = 0; i<e2.length;i++){
  2120. var a = false;
  2121. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  2122. available.push(a);
  2123. if(a){
  2124. availableindexes.push(i);
  2125. notempty = true;
  2126. }
  2127. }
  2128. if(notempty){
  2129. var above = [];
  2130. for(var i = 0;i<availableindexes.length;i++){
  2131. if(availableindexes[i]>quicki && !reverseqp){
  2132. above.push(availableindexes[i]);
  2133. }
  2134. else if(availableindexes[i]<quicki && reverseqp){
  2135. above.push(availableindexes[i])
  2136. }
  2137. }
  2138. if(above.length>0){
  2139. quicki = above[0];
  2140. if(reverseqp){
  2141. quicki = above[above.length-1];
  2142. }
  2143. }
  2144. else{
  2145. quicki = availableindexes[0];
  2146. if(reverseqp){
  2147. quicki = availableindexes[availableindexes.length-1];
  2148. }
  2149. }
  2150. }
  2151. }
  2152. }
  2153. canceled = false;
  2154. startedinqp = true;
  2155. window.map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length),0);
  2156. }
  2157. if(args.startsWith('42[32,')){
  2158. var jsonargs = JSON.parse(args.substring(2));
  2159. var keys = Object.keys(playerids);
  2160. if(!jsonargs[1]["t"]){
  2161. FFA = true;
  2162. for(var i = 0;i<keys.length;i++){
  2163. if(playerids[keys[i]].team!=0){
  2164. playerids[keys[i]].team = 1;
  2165. }
  2166. }
  2167. }
  2168. else{
  2169. FFA = false;
  2170. }
  2171. }
  2172. if(args.startsWith('42[5,')){
  2173. var jsonargs = JSON.parse(args.substring(2));
  2174. if(stopquickplay!=1 && startedinqp){
  2175. startedinqp = false;
  2176. jsonargs[1]["gs"]["wl"] = 999;
  2177. if(!instaqp){
  2178. var jsonargs2 = decodeIS(jsonargs[1]["is"]);
  2179. jsonargs2["ftu"] = 60;
  2180. if(jsonargs2["mm"]["rxa"] != ""){
  2181. jsonargs2["mm"]["a"] = jsonargs2["mm"]["rxa"];
  2182. jsonargs2["mm"]["n"] = jsonargs2["mm"]["rxn"];
  2183. }
  2184. jsonargs2 = encodeIS(jsonargs2);
  2185. jsonargs[1]["is"] = jsonargs2;
  2186. var jsonargs3 = decodeFromDatabase(jsonargs[1]["gs"]["map"]);
  2187. if(jsonargs3["m"]["rxa"] != ""){
  2188. jsonargs3["m"]["a"] = jsonargs3["m"]["rxa"];
  2189. jsonargs3["m"]["n"] = jsonargs3["m"]["rxn"];
  2190. }
  2191.  
  2192. jsonargs3 = encodeToDatabase(jsonargs3);
  2193. jsonargs[1]["gs"]["map"] = jsonargs3;
  2194. }
  2195. }
  2196.  
  2197. args = "42"+JSON.stringify(jsonargs);
  2198. }
  2199. }
  2200.  
  2201. }
  2202. else{
  2203. if(args.includes("rport")){
  2204. return;
  2205. }
  2206. }
  2207. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=") && !this.injected){
  2208. this.injected = true;
  2209.  
  2210. var originalRecieve = this.onmessage;
  2211. this.onmessage = function(args){
  2212. if(!bonkwssextra.includes(this)){
  2213. wssrecievelog.push(args.data);
  2214. wsssendrecievelog.push([1,args.data]);
  2215. if(typeof(args.data)=="string"){
  2216. args = {"data":RECIEVEFUNCTION(args.data)};
  2217. if(args.data.startsWith('42[1,')){
  2218. var jsonargs = JSON.parse(args.data.substring(2));
  2219. originalSend.call(this,'42[1,{"id":'+jsonargs[2]+'}]');
  2220. }
  2221. if(args.data.startsWith('42[36,')){
  2222. var jsonargs = JSON.parse(args.data.substring(2));
  2223. playerids[jsonargs[1]].playerData2.balance = jsonargs[2];
  2224. }
  2225. if(args.data.startsWith('42[24,')){
  2226. beenKickedTimeStamp = Date.now();
  2227. onlykicked = JSON.parse(args.data.substring(2))[2];
  2228. }
  2229. if(args.data.startsWith('42[21,')){
  2230. recievedinitdata = true;
  2231. }
  2232. if(args.data.startsWith('42[48,')){
  2233. recievedinitdata = true;
  2234. }
  2235. if(args.data.startsWith('42[23,')){
  2236. var jsonargs = JSON.parse(args.data.substring(2));
  2237. if(causelag){
  2238. jsonargs[1]["result"]-=causelag2;
  2239. }
  2240. args.data = '42'+JSON.stringify(jsonargs);
  2241. }
  2242. if(args.data.startsWith('42[16,')){
  2243. var jsonargs = JSON.parse(args.data.substring(2));
  2244. var now = Date.now();
  2245. if(jsonargs[1]=="chat_rate_limit"){
  2246. if(pollactive[1]+100>now){
  2247. pollactive = [false,0,0,[]];
  2248. displayInChat("Your poll failed due to chat rate limit.","#DA0808","#1EBCC1");
  2249. displayInChat("Please try again.","#DA0808","#1EBCC1");
  2250. }
  2251. }
  2252. else if(jsonargs[1]=="room_full"){
  2253. if(!savedrooms.includes(currentroomaddress)){
  2254. savedroombutton.className = "brownButton brownButton_classic buttonShadow";
  2255. }
  2256. }
  2257. }
  2258. if(args.data.startsWith('42[6,')){
  2259. var jsonargs = JSON.parse(args.data.substring(2));
  2260. if(typeof(playerids[jsonargs[1]])!='undefined'){
  2261. delplayerids[jsonargs[1]] = playerids[jsonargs[1]];
  2262. delete playerids[jsonargs[1]];
  2263. }
  2264. hostid = jsonargs[2];
  2265. }
  2266. if(args.data.startsWith('42[39,')){
  2267. var jsonargs = JSON.parse(args.data.substring(2));
  2268. var keys = Object.keys(playerids);
  2269. if(!jsonargs[1]){
  2270. FFA = true;
  2271. for(var i = 0;i<keys.length;i++){
  2272. if(playerids[keys[i]].team!=0){
  2273. playerids[keys[i]].team = 1;
  2274. }
  2275. }
  2276. }
  2277. else{
  2278. FFA = false;
  2279. }
  2280. }
  2281. if(args.data.startsWith('42[41,')){
  2282. var jsonargs = JSON.parse(args.data.substring(2));
  2283. hostid = jsonargs[1]["newHost"];
  2284. }
  2285. if(args.data.startsWith('42[20,')){
  2286. var jsonargs = JSON.parse(args.data.substring(2));
  2287. if(echo_list.includes(playerids[jsonargs[1]].userName)){
  2288. chat(flag_manage(echotext.replaceAll("username",playerids[jsonargs[1]].userName).replaceAll("message",jsonargs[2])));
  2289. }
  2290. if(randomchat){
  2291. var isin = false;
  2292. for(var i = 0;i<randomchatpriority[1].length;i++){
  2293. if(randomchatpriority[1][i][0] == jsonargs[2]){
  2294. isin = true;
  2295. if(myid!=jsonargs[1]){
  2296. randomchatpriority[1][i][1]+=2;
  2297. randomchatpriority[0]+=2;
  2298. }
  2299. break;
  2300. }
  2301. }
  2302. if(!isin){
  2303. randomchatpriority[1].push([jsonargs[2],Math.min(35-Math.abs(35-jsonargs[2].length),1)]);
  2304. randomchatpriority[0]+=Math.min(35-Math.abs(35-jsonargs[2].length),1);
  2305. }
  2306. }
  2307. if(pollactive[0] || pollactive2[0]){
  2308. var chatmessage = jsonargs[2].toUpperCase().trim().replace(")","");
  2309. var lettersindex = letters.indexOf(chatmessage);
  2310. if(ishost){
  2311. if(pollactive[3].length>0 && lettersindex!=-1 && lettersindex<pollactive[3].length){
  2312. playerids[jsonargs[1]].vote.poll = lettersindex;
  2313. }
  2314. }
  2315. else{
  2316. if(pollactive2[2].length>0 && lettersindex!=-1 && lettersindex<pollactive2[2].length){
  2317. playerids[jsonargs[1]].vote.poll = lettersindex;
  2318. }
  2319. }
  2320. }
  2321. }
  2322. if(args.data.startsWith('42[32')){
  2323. SEND('42[4,{"type":"inactive kick counter"}]');
  2324. }
  2325. if(args.data.startsWith('42[18')){
  2326. var jsonargs = JSON.parse(args.data.substring(2));
  2327. playerids[jsonargs[1]].team = jsonargs[2];
  2328. }
  2329. if(args.data.startsWith('42[40,')){
  2330. recordedTimeStamp = Date.now();
  2331. recordedId = JSON.parse(args.data.substring(2))[1];
  2332. }
  2333. if(args.data.startsWith('42[3,')){
  2334. playerids = {};
  2335. var jsonargs = JSON.parse(args.data.substring(2));
  2336. for(var i = 0; i<jsonargs[3].length;i++){
  2337. if(jsonargs[3][i]!=null){
  2338. playerids[i.toString()] = jsonargs[3][i];
  2339. playerids[i.toString()].commands = false;
  2340. playerids[i.toString()].ratelimit = {"pm":0,"mode":0,"team":0,"poll":0,"join":Date.now()};
  2341. playerids[i.toString()].vote = {"poll":-1};
  2342. }
  2343. }
  2344. if(playerids[jsonargs[1]].userName.startsWith(Gdocument.getElementById("pretty_top_name").textContent)){
  2345. myid = jsonargs[1];
  2346. bonkwss = this;
  2347. playerids[myid].commands = true;
  2348. }
  2349. else{
  2350. bonkwssextra.push(this);
  2351. }
  2352. inroom = true;
  2353. hostid = jsonargs[2];
  2354. SEND('42[4,{"type":"commands"}]');
  2355. ghostroomwss = bonkwss;
  2356. Gdocument.getElementById("roomlistrefreshbutton").click();
  2357. setTimeout(function(){if(bonkwss == ghostroomwss && !sandboxon && !recievedinitdata && myid!=0){RECIEVE('42[21,{"map":{"v":13,"s":{"re":false,"nc":false,"pq":1,"gd":25,"fl":false},"physics":{"shapes":[],"fixtures":[],"bodies":[],"bro":[],"joints":[],"ppm":12},"spawns":[],"capZones":[],"m":{"a":"","n":"","dbv":0,"dbid":0,"authid":-1,"date":"","rxid":0,"rxn":"","rxa":"","rxdb":0,"cr":[],"pub":false,"mo":"","vu":0,"vd":0}},"gt":2,"wl":3,"q":false,"tl":false,"tea":false,"ga":"b","mo":"b","bal":[]}]');displayInChat("You have joined a ghost room.","#DA0808","#1EBCC1");}},6000);
  2358.  
  2359. }
  2360. if(args.data.startsWith('42[21,')){
  2361. var jsonargs = JSON.parse(args.data.substring(2));
  2362. mode = jsonargs[1]["mo"];
  2363. FFA = !jsonargs[1]["tea"];
  2364. }
  2365. if(args.data.startsWith('42[48,')){
  2366. var jsonargs = JSON.parse(args.data.substring(2));
  2367. mode = jsonargs[1]["gs"]["mo"];
  2368. FFA = !jsonargs[1]["gs"]["tea"];
  2369. }
  2370. if(args.data.startsWith('42[15,')){
  2371. var jsonargs = JSON.parse(args.data.substring(2));
  2372. dontswitch = false;
  2373. mode = jsonargs[3]["mo"];
  2374. gameStartTimeStamp = Date.now();
  2375. killedids = [];
  2376. Gdocument.getElementById("newbonklobby").style["z-index"] = "unset";
  2377. Gdocument.getElementById("mapeditorcontainer").style["z-index"] = "unset";
  2378. }
  2379. if(args.data.startsWith('42[33,')){
  2380. var jsonargs = JSON.parse(args.data.substring(2));
  2381. var decodedmap = decodeFromDatabase(jsonargs[1]);
  2382. if(decodedmap!=0){
  2383. requestedmaps = [[decodedmap,jsonargs[1]]].concat(requestedmaps);
  2384. }
  2385. }
  2386. if(args.data.startsWith('42[7,')){
  2387. var jsonargs2 = JSON.parse(args.data.substring(2));
  2388. var idofpacket = jsonargs2[1];
  2389. jsonargs = jsonargs2[2];
  2390. if(typeof(jsonargs["i"]) == "undefined"){
  2391. if(jsonargs["type"]=="private chat" && jsonargs["to"] == username){
  2392. from = jsonargs["from"];
  2393. if(Object.keys(playerids).includes(idofpacket.toString())){
  2394. from = playerids[idofpacket].userName;
  2395. }
  2396. if(!ignorepmlist.includes(from)){
  2397. if(typeof(jsonargs["message"])=="object" && typeof(jsonargs["password"]) == "object"){
  2398. if(public_key[0]==jsonargs["public key"][0] && public_key[1]==jsonargs["public key"][1]){
  2399. var now = Date.now();
  2400. if(jsonargs["password"].length<=25 && playerids[idofpacket].ratelimit.pm+250<now){
  2401. playerids[idofpacket].ratelimit.pm = now;
  2402. var password = CRYPT_MESSAGE(private_key,jsonargs["password"]);
  2403. var decodedtext = jsonargs["message"].slice(0,400);
  2404. var encodedtext = "";
  2405. for(var i=0;i<decodedtext.length;i++){
  2406. if(password[i%password.length]<1000){
  2407. encodedtext+=String.fromCharCode(password[i%password.length]^decodedtext[i]);
  2408. }
  2409. }
  2410. 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);';
  2411. displayInChat('> '+'<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">'+from+'</a>'+': ',"#DA0808","#1EBCC1",{sanitize:false},encodedtext);
  2412.  
  2413. Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true;
  2414. Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true;
  2415. Laster_message = lastmessage();
  2416. }
  2417. }
  2418. else{
  2419. SEND("42"+JSON.stringify([4,{"type":"public key correction","from":username,"to":private_chat_public_key[0],"public key":public_key}]));
  2420. }
  2421. }
  2422. }
  2423. }
  2424. if(jsonargs["type"]=="request public key" && jsonargs["to"] == username){
  2425. SEND("42"+JSON.stringify([4,{"type":"public key","from":username,"public key":public_key}]));
  2426. }
  2427. if(jsonargs["type"]=="private chat users" && pmuserstimestamp+1500>Date.now()){
  2428. if(typeof(jsonargs["from"])!='undefined'){
  2429. from = jsonargs["from"];
  2430. if(Object.keys(playerids).includes(idofpacket.toString())){
  2431. from = playerids[idofpacket].userName;
  2432. }
  2433. if(!pmusers.includes(from) && username == jsonargs["to"]){
  2434. pmusers.push(from);
  2435. }
  2436. }
  2437. }
  2438. if(jsonargs["type"]=="request private chat users"){
  2439. if(typeof(jsonargs["from"])!='undefined'){
  2440. from = jsonargs["from"];
  2441. if(Object.keys(playerids).includes(idofpacket.toString())){
  2442. from = playerids[idofpacket].userName;
  2443. }
  2444. SEND("42"+JSON.stringify([4,{"type":"private chat users","from":username,"to":from}]));
  2445. }
  2446. }
  2447. if(jsonargs["type"]=="public key" && request_public_key_time_stamp+1500>Date.now()){
  2448. from = jsonargs["from"];
  2449. if(Object.keys(playerids).includes(idofpacket.toString())){
  2450. from = playerids[idofpacket].userName;
  2451. }
  2452. if(from == private_chat){
  2453. private_chat_public_key = [private_chat,jsonargs["public key"]];
  2454. displayInChat("Private chatting with "+private_chat+".","#DA0808","#1EBCC1");
  2455. }
  2456. }
  2457. if(jsonargs["type"]=="fakerecieve" && hostid == idofpacket && sandboxon && ((jsonargs["to"].includes(myid) && jsonargs["to"][0]!=-1) || (!jsonargs["to"].includes(myid) && jsonargs["to"][0]==-1))){
  2458. for(var i = 0;i<jsonargs["packet"].length;i++){
  2459. if(!jsonargs["packet"][i].startsWith("42[20,")){
  2460. RECIEVE(jsonargs["packet"][i]);
  2461. }
  2462. }
  2463. }
  2464. if(jsonargs["type"]=="customfakerecieve" && hostid == idofpacket && sandboxon && ((jsonargs["to"].includes(myid) && jsonargs["to"][0]!=-1) || (!jsonargs["to"].includes(myid) && jsonargs["to"][0]==-1))){
  2465. for(var i2 = 0;i2<jsonargs["packet"].length;i2++){
  2466. var keys = Object.keys(sandboxplayerids);
  2467. for(var i = 0;i<keys.length;i++){
  2468. if(jsonargs["packet"][i2].startsWith("42[7,")){
  2469. originalRecieve.call(this,{data:jsonargs["packet"][i2].replace("ID",keys[i].toString()).replace("CVALUE",playerids[keys[i]].movecount.toString())});
  2470. playerids[keys[i]].movecount+=1;
  2471. }
  2472. }
  2473. }
  2474. }
  2475. if(jsonargs["type"]=="commands"){
  2476. playerids[idofpacket].commands = true;
  2477. }
  2478. if(jsonargs["type"]=="sandboxid" && hostid == idofpacket && sandboxon && ((jsonargs["to"].includes(myid) && jsonargs["to"][0]!=-1) || (!jsonargs["to"].includes(myid) && jsonargs["to"][0]==-1))){
  2479. sandboxid = jsonargs["lastid"];
  2480. }
  2481. if(jsonargs["type"]=="sandboxon" && idofpacket == hostid){
  2482. if(!sandboxon){
  2483. displayInChat("This is a sandbox lobby.","#DA0808","#1EBCC1");
  2484. sandboxon = true;
  2485. }
  2486. }
  2487. if(jsonargs["type"]=="vote poll"){
  2488. from = jsonargs["from"];
  2489. if(Object.keys(playerids).includes(idofpacket.toString())){
  2490. from = playerids[idofpacket].userName;
  2491. }
  2492. if(typeof(jsonargs["vote"]) == 'number' && idofpacket!=hostid){
  2493. var now = Date.now();
  2494. if(ishost && pollactive[3].length>1 && pollactive[0]){
  2495. if(jsonargs["vote"]>=0 && jsonargs["vote"]<pollactive[3].length){
  2496. playerids[idofpacket].vote.poll = jsonargs["vote"];
  2497. }
  2498. }
  2499. else if(pollactive2[0] && pollactive2[2].length>1){
  2500. if(jsonargs["vote"]>=0 && jsonargs["vote"]<pollactive2[2].length){
  2501. playerids[idofpacket].vote.poll = jsonargs["vote"];
  2502. }
  2503. }
  2504. }
  2505.  
  2506. }
  2507. if(jsonargs["type"]=="poll end"){
  2508. from = jsonargs["from"];
  2509. if(Object.keys(playerids).includes(idofpacket.toString())){
  2510. from = playerids[idofpacket].userName;
  2511. }
  2512. var now = Date.now();
  2513. if(hostid == idofpacket && playerids[idofpacket].ratelimit.poll+5000<now){
  2514. playerids[idofpacket].ratelimit.poll = now;
  2515. var count = [0,0,0,0];
  2516. var keys = Object.keys(playerids);
  2517. for(var i = 0;i<keys.length;i++){
  2518. if(playerids[keys[i]].vote.poll!=-1 && playerids[keys[i]].vote.poll<pollactive2[2].length-1){
  2519. count[playerids[keys[i]].vote.poll]++;
  2520. }
  2521. playerids[keys[i]].vote.poll = -1;
  2522. }
  2523. displayInChat("The poll ended.","#DA0808","#1EBCC1");
  2524. for(var i = 0;i<count.length;i++){
  2525. if(count[i]>1){
  2526. displayInChat(count[i].toString()+" people voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  2527. }
  2528. if(count[i]==1){
  2529. displayInChat(count[i].toString()+" person voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  2530. }
  2531. }
  2532. pollactive2 = [false,0,[]];
  2533. }
  2534.  
  2535. }
  2536. if(jsonargs["type"] == "video player" && idofpacket == hostid && ((jsonargs["to"].includes(myid) && jsonargs["to"][0]!=-1) || (!jsonargs["to"].includes(myid) && jsonargs["to"][0]==-1))){
  2537. if(jsonargs["url"]!=""){
  2538. displayInChat("The jukebox has been changed to: ","#DA0808","#1EBCC1",{sanitize:false},jsonargs["url"]);
  2539. }
  2540. else{
  2541. displayInChat("The jukebox has been paused.","#DA0808","#1EBCC1");
  2542. }
  2543. jukeboxplayerURL = jsonargs["url"];
  2544. changeJukeboxURL(jukeboxplayerURL,jsonargs["timestamp"]);
  2545. }
  2546. if(jsonargs["type"]=="poll" && idofpacket == hostid){
  2547. from = jsonargs["from"];
  2548. if(Object.keys(playerids).includes(idofpacket.toString())){
  2549. from = playerids[idofpacket].userName;
  2550. }
  2551. if(Array.isArray(jsonargs["poll"])){
  2552. var propperpoll = true;
  2553. var pollifproper = [];
  2554. if(jsonargs["poll"].length>5){
  2555. propperpoll = false;
  2556. }
  2557. else{
  2558. for(var i = 0;i<jsonargs["poll"].length;i++){
  2559. if(typeof(jsonargs["poll"][i]) == 'string'){
  2560. if(jsonargs["poll"][i].length>50){
  2561. propperpoll = false;
  2562. break;
  2563. }
  2564. else{
  2565. pollifproper.push(jsonargs["poll"][i]);
  2566. }
  2567. }
  2568. else{
  2569. propperpoll = false;
  2570. break;
  2571. }
  2572. }
  2573. }
  2574. if(propperpoll){
  2575. var now = Date.now();
  2576. var keys = Object.keys(playerids);
  2577. for(var i = 0;i<keys.length;i++){
  2578. playerids[keys[i]].vote.poll = -1;
  2579. }
  2580. pollactive2 = [true,now,pollifproper];
  2581. playerids[idofpacket].ratelimit.poll = now;
  2582. displayInChat(from+" started a poll:","#DA0808","#1EBCC1");
  2583. for(var i = 0;i<pollifproper.length;i++){
  2584. var code = 'Gwindow.displayInChat("You voted for option '+letters[i]+'.","#DA0808","#1EBCC1",{sanitize:false},"",true);Gwindow.SEND("42"+JSON.stringify([4,{"type":"vote poll","from":Gwindow.username,"vote":'+i+'}]));Gwindow.playerids[Gwindow.myid].vote.poll='+i+';Gwindow.Gdocument.getElementById("newbonklobby_chat_content").children[Gwindow.Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true;Gwindow.Gdocument.getElementById("ingamechatcontent").children[Gwindow.Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true;Gwindow.Laster_message = Gwindow.lastmessage();';
  2585. displayInChat('<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">'+letters[i]+')</a>',"#DA0808","#1EBCC1",{sanitize:false}," "+pollifproper[i]);
  2586. }
  2587. }
  2588. }
  2589. }
  2590. if(jsonargs["type"]=="request mode" && playerids[idofpacket].ratelimit.mode+1000<Date.now()){
  2591. playerids[idofpacket].ratelimit.mode = Date.now();
  2592. from = jsonargs["from"];
  2593. if(Object.keys(playerids).includes(idofpacket.toString())){
  2594. from = playerids[idofpacket].userName;
  2595. }
  2596. var req_mode = jsonargs["mode"];
  2597. var req_mode2 = "";
  2598. if(req_mode){
  2599. if(req_mode == "b"){
  2600. req_mode2 = "Classic";
  2601. }
  2602. else if(req_mode == "sp"){
  2603. req_mode2 = "Grapple";
  2604. }
  2605. else if(req_mode == "ar"){
  2606. req_mode2 = "Arrows";
  2607. }
  2608. else if(req_mode == "ard"){
  2609. req_mode2 = "Death Arrows";
  2610. }
  2611. }
  2612. if(req_mode2){
  2613. var code = 'if(!Gwindow.ishost){Gwindow.displayInChat("You must be host to change the mode.","#DA0808","#1EBCC1",{sanitize:false},"",true)}else{Gwindow.changemode("'+req_mode+'")}';
  2614. displayInChat('> '+playerids[idofpacket].userName+' requests [<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">'+req_mode2+'</a>]',"#DA0808","#1EBCC1",{sanitize:false}," mode.");
  2615. }
  2616.  
  2617. }
  2618. if(jsonargs["type"]=="public key correction" && private_chat_public_key[0] == private_chat){
  2619. from = jsonargs["from"];
  2620. if(Object.keys(playerids).includes(idofpacket.toString())){
  2621. from = playerids[idofpacket].userName;
  2622. }
  2623. if(from == private_chat){
  2624. private_chat_public_key = [private_chat,jsonargs["public key"]];
  2625. var text = pmlastmessage;
  2626. var password = [];
  2627. for(var i = 0;i<10;i++){
  2628. password.push(Math.floor(Math.random()*100+50));
  2629. }
  2630. var text2 = [];
  2631. for(var i = 0;i<text.length ;i++){
  2632. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  2633. }
  2634. cc
  2635. }
  2636. }
  2637.  
  2638. }
  2639. else{
  2640. var now = Date.now();
  2641. playerids[idofpacket.toString()].movecount+=1;
  2642. if(playerids[idofpacket.toString()]){
  2643. playerids[idofpacket.toString()].lastmove = now;
  2644. }
  2645. if(Math.abs(gameStartTimeStamp - (now-1000*jsonargs["f"]/30))>250){
  2646. gameStartTimeStamp = now-1000*jsonargs["f"]/30;
  2647. }
  2648. if(recording){
  2649. if(idofpacket.toString() == recordingid){
  2650. if(recordingdata.length == 0){
  2651. recordingdata.push([jsonargs["i"],jsonargs["f"]]);
  2652. }
  2653. recordingdata.push([jsonargs["i"],jsonargs["f"]-recordingdata[0][1]]);
  2654. }
  2655. }
  2656. if(ishost){
  2657. if(sandboxon && idofpacket == sandboxcopyme){
  2658. var jsonkeys = Object.keys(sandboxplayerids);
  2659. if(!jsonkeys.includes(sandboxcopyme.toString())){
  2660. var jsonargs2 = jsonargs;
  2661. for(var i = 0; i<jsonkeys.length;i++){
  2662. jsonargs2["c"] = playerids[jsonkeys[i]].movecount;
  2663. var packet = '42[7,'+jsonkeys[i].toString()+','+JSON.stringify(jsonargs2)+']';
  2664. RECIEVE(packet);
  2665. }
  2666. jsonargs2["c"] = "CVALUE";
  2667. jsonargs2 = JSON.stringify(jsonargs2).replace('"CVALUE"',"CVALUE");
  2668. SEND("42"+JSON.stringify([4,{"type":"customfakerecieve","from":username,"packet":['42[7,ID,'+jsonargs2+']'],to:[-1]}]));
  2669. }
  2670. }
  2671. for(var i = 0;i<disabledkeys.length;i++){
  2672. var get_keys_var = GET_KEYS(jsonargs["i"]);
  2673. if(get_keys_var[disabledkeys[i]]){
  2674. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden" && !killedids.includes(idofpacket)){
  2675. killedids.push(idofpacket);
  2676. currentFrame = Math.floor((Date.now() - gameStartTimeStamp)/1000*30);
  2677. SEND('42[25,{"a":{"playersLeft":['+idofpacket.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  2678. RECIEVE('42[31,{"a":{"playersLeft":['+idofpacket.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  2679. break;
  2680. }
  2681. }
  2682. }
  2683. }
  2684. }
  2685. }
  2686.  
  2687. if(args.data.startsWith('42[4,')){
  2688. var jsonargs = JSON.parse(args.data.substring(2));
  2689. playerids[jsonargs[1]] = {"peerID":jsonargs[2],"userName":jsonargs[3],"guest":jsonargs[4],"level":jsonargs[5],"team":jsonargs[6],"avatar":jsonargs[7],"movecount":0,"ratelimit":{"pm":0,"mode":0,"team":0,"poll":0,"join":Date.now()},"vote":{"poll":-1}};
  2690. if(jsonargs[2]!="sandbox"){
  2691. SEND('42[4,{"type":"commands"}]');
  2692. }
  2693. if(sandboxon){
  2694. var sandboxkeys = Object.keys(sandboxplayerids);
  2695. if(sandboxkeys.includes(jsonargs[1].toString())){
  2696. delete sandboxplayerids[jsonargs[1]];
  2697. }
  2698. if(jsonargs[2]=="sandbox"){
  2699. sandboxplayerids[jsonargs[1]] = jsonargs[3];
  2700. if(jsonargs[1]>sandboxid){
  2701. sandboxid = parseInt(jsonargs[1])+1;
  2702. }
  2703. }
  2704. else{
  2705. if(ishost){
  2706. SEND('42[4,{"type":"sandboxon"}]');
  2707. var sandboxkeys = Object.keys(sandboxplayerids);
  2708. var packets = [];
  2709. for(var i = 0;i<sandboxkeys.length;i++){
  2710. var p = playerids[sandboxkeys[i]];
  2711. var packet = '42'+JSON.stringify([4,sandboxkeys[i],p.peerID,p.userName,p.guest,p.level,p.team,p.avatar]);
  2712. packets.push(packet);
  2713. }
  2714. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":packets,to:[jsonargs[1]]}]));
  2715. SEND("42"+JSON.stringify([4,{"type":"sandboxid","from":username,"lastid":sandboxid,to:[jsonargs[1]]}]));
  2716. }
  2717. }
  2718. }
  2719. if(ishost){
  2720. if(jointext!="" && jsonargs[2]!="sandbox"){
  2721. chat(flag_manage(jointext.replaceAll("username",jsonargs[3])));
  2722. }
  2723. if(jointeam!=-1 && jsonargs[2]!="sandbox"){
  2724. SEND('42[26,{"targetID":'+jsonargs[1].toString()+',"targetTeam":'+jointeam.toString()+'}]');
  2725. setTimeout(function(){RECIEVE('42[18,'+jsonargs[1].toString()+','+jointeam.toString()+']');});
  2726. }
  2727. if(jukeboxplayer.src!="" && !jukeboxplayer.paused){
  2728. SEND("42"+JSON.stringify([4,{"type":"video player","from":username,"url":jukeboxplayerURL,"timestamp":Date.now()-jukeboxplayer.currentTime*1000,"to":[jsonargs[1]]}]));
  2729. }
  2730. if(freejoin){
  2731. var count = 0;
  2732. var keys = Object.keys(playerids);
  2733. for(var i = 0; i<keys.length;i++){
  2734. if(playerids[keys[i]].team!=0){
  2735. count++;
  2736. }
  2737. }
  2738. if(count <= 2 && jsonargs[6]!=0){
  2739. setTimeout(function(){
  2740. Gdocument.getElementById("newbonklobby_editorbutton").click();
  2741. Gdocument.getElementById("mapeditor_close").click();
  2742. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  2743. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  2744. if(transitioning == true){
  2745. canceled = true;
  2746. }
  2747. },150);
  2748. }
  2749. }
  2750. }
  2751.  
  2752. }
  2753. if(args.data.startsWith('42[5,')){
  2754. var jsonargs = JSON.parse(args.data.substring(2));
  2755. if(typeof(playerids[jsonargs[1]])!='undefined'){
  2756. delplayerids[jsonargs[1]] = playerids[jsonargs[1]];
  2757. delete playerids[jsonargs[1]];
  2758. }
  2759. if(sandboxon && typeof(sandboxplayerids[jsonargs[1]])!='undefined'){
  2760. delete sandboxplayerids[jsonargs[1]];
  2761. }
  2762. }
  2763. }}
  2764. return originalRecieve.call(this,args);
  2765. };
  2766.  
  2767. var originalClose = this.onclose;
  2768. this.onclose = function () {
  2769. if(bonkwssextra.includes(this)){
  2770. bonkwssextra.splice(bonkwssextra.indexOf(this),1)
  2771. }
  2772. else{
  2773. window.bonkwss = 0;
  2774. }
  2775. return originalClose.call(this);
  2776. }
  2777.  
  2778. }
  2779. return originalSend.call(this,args);
  2780. };
  2781.  
  2782. scope.SEND = function(args){
  2783. if(bonkwss!=0){
  2784. bonkwss.send(args);
  2785. }
  2786. };
  2787. scope.RECIEVE = function(args){
  2788. if(bonkwss!=0){
  2789. bonkwss.onmessage({data:args});
  2790. }
  2791. };
  2792.  
  2793.  
  2794.  
  2795. scope.dontswitch = false;
  2796. scope.username = 0;
  2797. scope.timedelay = 1400;
  2798. scope.ishost = false;
  2799. scope.checkboxhidden = true;
  2800. scope.quicki=0;
  2801. scope.defaultmode = "d";
  2802. scope.recmodebool = false;
  2803. scope.shuffle = false;
  2804. scope.startedinqp = false;
  2805. scope.instaqp = false;
  2806. scope.freejoin = false;
  2807. scope.recordedTimeStamp = 0;
  2808. scope.recordedId = 0;
  2809. scope.smartteams = false;
  2810. scope.beenKickedTimeStamp = 0;
  2811. scope.stopquickplay = 1;
  2812. scope.currentFrame = 0;
  2813. scope.text2speech = false;
  2814. scope.gameStartTimeStamp = 0;
  2815. scope.canceled = false;
  2816. scope.wintext = "";
  2817. scope.banned = [];
  2818. scope.transitioning = false;
  2819. scope.echo_list = [];
  2820. scope.echoAppend = "";
  2821. scope.message = "";
  2822. scope.private_chat = "";
  2823. scope.private_chat_public_key = ["",[0,0]];
  2824. scope.disabledkeys = [];
  2825. scope.actuallyhost = false;
  2826. scope.pmusers = [];
  2827. scope.pmlastmessage = "";
  2828. scope.pmuserstimestamp = 0;
  2829. scope.ignorepmlist = [];
  2830. scope.scroll = false;
  2831. scope.elem = Gdocument.getElementById("maploadwindowmapscontainer");
  2832. scope.npermissions = 1;
  2833. scope.space_flag = false;
  2834. scope.rcaps_flag = false;
  2835. scope.number_flag = false;
  2836. scope.reverse_flag = false;
  2837. scope.request_public_key_time_stamp = 0;
  2838. scope.sandboxcopyme = -1;
  2839. scope.recteams = false;
  2840. scope.chatheight = 128;
  2841. scope.onlykicked = false;
  2842. scope.killedids = [];
  2843. scope.jointext = "";
  2844. scope.randomchat = false;
  2845. scope.randomchatpriority = [0,[]];
  2846. scope.randomchatlastmessage = ["",0];
  2847. scope.afkkill = -1;
  2848. scope.tournament_mode = "";
  2849. scope.tournament_scores = [];
  2850. scope.tournament_in_and_out = {"in":[],"out":[]};
  2851. scope.echotext = "message";
  2852. scope.nextafter = 0;
  2853. scope.nextafterbuffer = -1;
  2854. scope.roundsperqp = 1;
  2855. scope.roundsperqp2 = 0;
  2856. scope.autorecord = false;
  2857. scope.poll = [];
  2858. scope.letters = ["A","B","C","D","E"];
  2859. scope.qppaused = false;
  2860. scope.FollowCam = false;
  2861. scope.autocam = false;
  2862. scope.gravity = 20;
  2863. scope.randomchat = false;
  2864. scope.randomchat_randomtimestamp = 0;
  2865. scope.randomchat_timestamp = 0;
  2866. scope.multiplier = 3.65;
  2867. scope.aimbot = false;
  2868. scope.recievedinitdata = false;
  2869. scope.heavybot = false;
  2870. scope.zoom = 1;
  2871. scope.prediction = 350;
  2872. scope.started = 0;
  2873. scope.holdheavy = 0;
  2874. scope.grappleheld = false;
  2875. scope.grappleheld2 = false;
  2876. scope.heavyheld = false;
  2877. scope.reverseqp = false;
  2878. scope.jointeam = -1;
  2879. scope.heavyheld2 = false;
  2880. scope.heavyid = 3;
  2881. scope.specialid = 0;
  2882. scope.keyCodes = {"BACK_SPACE":8,"TAB":9,"SHIFT":16,"ALT":18,"LEFT ARROW":37,"RIGHT ARROW":39,"DOWN ARROW":40,"UP ARROW":38,"CONTROL":17,"SPACE":32};
  2883. scope.leftRight = [37,39];
  2884. scope.upDown = [38,40];
  2885. scope.heavy = 88;
  2886. scope.special = 90;
  2887. scope.newzoom2 = 1;
  2888. scope.staystill = false;
  2889. scope.staystillpos = [0,0];
  2890. scope.zoom2 = 1;
  2891. scope.autokickban = 0;
  2892. scope.ghostroomwss = -1;
  2893. scope.autokickbantimestamp = 0;
  2894. scope.getroomslastcheck = 0;
  2895. scope.causelag = false;
  2896. scope.causelag2 = 0;
  2897. scope.overideDate = [false,0];
  2898. scope.scale = 1;
  2899. scope.replaycounter = 0;
  2900. scope.replaykeysheld = 0;
  2901. scope.replaynow = 0;
  2902. scope.stopreplay = false;
  2903. scope.positive = function(angle){
  2904. if(angle<0){
  2905. angle += 2*Math.PI;
  2906. }
  2907. return angle%(Math.PI*2);
  2908. };
  2909. scope.angle_between = function(angle,angle2){
  2910. return Math.min(Math.abs(positive(angle)-positive(angle2)),Math.PI*2-Math.abs(positive(angle)-positive(angle2)));
  2911. };
  2912. scope.angle_between2 = function(angle,angle2){
  2913. if(angle_between(angle,angle2+Math.PI/2)<Math.PI/2){
  2914. return 1;
  2915. }
  2916. return -1;
  2917. };
  2918. scope.replay = function(){
  2919. if(replaycounter>=recordingdata.length){
  2920. replaycounter = 0;
  2921. overideDate = [false,0];
  2922. stopreplay = false;
  2923. return;
  2924. }
  2925. overideDate = [true,recordingdata[replaycounter][1]*100/3+replaynow];
  2926. setTimeout(function(){
  2927. presskeys(replaykeysheld,GET_KEYS(recordingdata[replaycounter][0]));
  2928. replaykeysheld = GET_KEYS(recordingdata[replaycounter][0]);
  2929. overideDate = [false,0];
  2930. replaycounter+=1;
  2931. },75);
  2932. if(stopreplay || replaycounter>=recordingdata.length){
  2933. setTimeout(function(){
  2934. replaycounter = 0;
  2935. overideDate = [false,0];
  2936. stopreplay = false;
  2937. },100);
  2938. return;
  2939. }
  2940. setTimeout(replay,200)/*recordingdata[replaycounter][1]*100/3-recordingdata[replaycounter-1][1]*100/3);*/
  2941. };
  2942. scope.presskeys = function(x,y){
  2943. if(!x.left && y.left){
  2944. fire("keydown",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  2945. }
  2946. else if(x.left && !y.left){
  2947. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  2948. }
  2949. if(!x.right && y.right){
  2950. fire("keydown",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  2951. }
  2952. else if(x.right && !y.right){
  2953. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  2954. }
  2955. if(!x.up && y.up){
  2956. fire("keydown",{"keyCode":upDown[0]},Gdocument.getElementById("gamerenderer"));
  2957. }
  2958. else if(x.up && !y.up){
  2959. fire("keyup",{"keyCode":upDown[0]},Gdocument.getElementById("gamerenderer"));
  2960. }
  2961. if(!x.down && y.down){
  2962. fire("keydown",{"keyCode":upDown[1]},Gdocument.getElementById("gamerenderer"));
  2963. }
  2964. else if(x.down && !y.down){
  2965. fire("keyup",{"keyCode":upDown[1]},Gdocument.getElementById("gamerenderer"));
  2966. }
  2967. if(!x.heavy && y.heavy){
  2968. fire("keydown",{"keyCode":heavy},Gdocument.getElementById("gamerenderer"));
  2969. }
  2970. else if(x.heavy && !y.heavy){
  2971. fire("keyup",{"keyCode":heavy},Gdocument.getElementById("gamerenderer"));
  2972. }
  2973. if(!x.special && y.special){
  2974. fire("keydown",{"keyCode":special},Gdocument.getElementById("gamerenderer"));
  2975. }
  2976. else if(x.special && !y.special){
  2977. fire("keyup",{"keyCode":special},Gdocument.getElementById("gamerenderer"));
  2978. }
  2979. };
  2980. scope.getplayerkeys = function(){
  2981. var keykeys = Object.keys(keyCodes);
  2982. var keyslist = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[1].children).slice(1);
  2983. var keyslist2 = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[2].children).slice(1);
  2984. var keyslist3 = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[3].children).slice(1);
  2985. var keyslist4 = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[4].children).slice(1);
  2986. var keyslist5 = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[5].children).slice(1);
  2987. var keyslist6 = Array.from(Gdocument.getElementById("redefineControls_table").children[0].children[6].children).slice(1);
  2988. for(var i = 0;i<keyslist.length;i++){
  2989. if(keykeys.includes(keyslist[i].textContent)){
  2990. leftRight[0] = keyCodes[keyslist[i].textContent];
  2991. break;
  2992. }
  2993. else{
  2994. leftRight[0] = keyslist[i].textContent.charCodeAt(0);
  2995. break
  2996. }
  2997. }
  2998. for(var i = 0;i<keyslist2.length;i++){
  2999. if(keykeys.includes(keyslist2[i].textContent)){
  3000. leftRight[1] = keyCodes[keyslist2[i].textContent];
  3001. break;
  3002. }
  3003. else{
  3004. leftRight[1] = keyslist2[i].textContent.charCodeAt(0);
  3005. break
  3006. }
  3007. }
  3008. for(var i = 0;i<keyslist3.length;i++){
  3009. if(keykeys.includes(keyslist3[i].textContent)){
  3010. upDown[0] = keyCodes[keyslist3[i].textContent];
  3011. break;
  3012. }
  3013. else{
  3014. upDown[0] = keyslist3[i].textContent.charCodeAt(0);
  3015. break
  3016. }
  3017. }
  3018. for(var i = 0;i<keyslist4.length;i++){
  3019. if(keykeys.includes(keyslist4[i].textContent)){
  3020. upDown[1] = keyCodes[keyslist4[i].textContent];
  3021. break;
  3022. }
  3023. else{
  3024. upDown[1] = keyslist4[i].textContent.charCodeAt(0);
  3025. break
  3026. }
  3027. }
  3028. for(var i = 0;i<keyslist5.length;i++){
  3029. if(keykeys.includes(keyslist5[i].textContent)){
  3030. heavy = keyCodes[keyslist5[i].textContent];
  3031. break;
  3032. }
  3033. else{
  3034. heavy = keyslist5[i].textContent.charCodeAt(0);
  3035. break
  3036. }
  3037. }
  3038. for(var i = 0;i<keyslist6.length;i++){
  3039. if(keykeys.includes(keyslist6[i].textContent)){
  3040. special = keyCodes[keyslist6[i].textContent];
  3041. break;
  3042. }
  3043. else{
  3044. special = keyslist6[i].textContent.charCodeAt(0);
  3045. break
  3046. }
  3047. }
  3048. };
  3049. scope.changeJukeboxURL = function(url,timestamp = 0){
  3050. if(url == ""){
  3051. jukeboxplayer.pause();
  3052. jukeboxplayer.src = '';
  3053. }
  3054. else{
  3055. try{
  3056. var id = (((url.replaceAll("https://www.youtube.com/watch?v=","").replaceAll("https://youtu.be/","")).split("?"))[0]).replaceAll(" ","");
  3057. fetch("https://pipedapi.kavin.rocks/streams/"+id).then(function(response){
  3058. if(response.ok){
  3059. response.json().then(function(data){
  3060. var streams = data.audioStreams;
  3061. var audio = 0;
  3062. for(var i = 0;i<streams.length;i++){
  3063. if(streams[i].url){
  3064. audio = streams[i].url;
  3065. }
  3066. }
  3067. var src = audio;
  3068. fetch(src).then(function(){
  3069. jukeboxplayer.src = src;
  3070. jukeboxplayer.volume = jukeboxplayervolume/100;
  3071. displayInChat("Jukebox is now playing: "+data.title+" by "+data.uploader+".","#DA0808","#1EBCC1");
  3072. jukeboxplayer.currentTime = (Date.now()-timestamp)/1000;
  3073. jukeboxplayerURL = url;
  3074. jukeboxplayer.play();
  3075. }).catch(function(){
  3076. jukeboxplayer.src = "";
  3077. displayInChat("The jukebox failed to load. Please try again.","#DA0808","#1EBCC1");
  3078. });
  3079. });
  3080. }
  3081. });
  3082. }
  3083. catch{
  3084. displayInChat("The jukebox failed to load. Please try again.","#DA0808","#1EBCC1");
  3085. }
  3086. }
  3087. };
  3088. scope.help = ["All the commands are:","/help","/?","/advhelp [command]","/space","/rcaps","/number","/randomchat","/speech","/savedroom","/clearsavedroom","/followcam","/autocam","/zoom [in/out/reset]","/xray","/aimbot","/heavybot","/still","/echo [username]","/clearecho","/remove [username]","/echotext [text]","/chatw [username]","/msg [text]","/ignorepm [username]","/record [username]","/replay","/stoprecord","/loadrecording [text]","/saverecording [text]","/delrecording [text]","/volume [1-100]","/pmusers","/pollstat","/lobby","/score","/team [letter]","/mode [mode]","/scroll","/hidechat","/showchat","/notify","/stopnotify","/support","Host commands are:","/startqp","/stopqp","/pauseqp","/revqp","/next","/nextafter [seconds]","/previous","/shuffle","/instaqp","/jukebox [link]","pausejukebox","/resetjukebox","/playjukebox","/freejoin","/recmode","/recteam","/defaultmode [mode]","/start","/balanceA [number]","/moveA [letter]","/moveT [letter] [letter]","/rounds [number]","/roundsperqp [number]","/disablekeys [keys]","/jointext [text]","/jointeam [letter]","/wintext [text]","/autorecord","/afkkill [number]","/ban [username]","/kill [username]","/resetpoll","/addoption [text]","/deloption [letter]","/startpoll [seconds]","/endpoll","/autokick","/autoban","/sandbox","Sandbox commands are:","/addplayer [number]","/addname [text]","/delplayer [number]","/copy [username]","Debugging commands are:","/eval [code]","/debugger","Hotkeys are:","Alt L","Alt B","Alt C","Alt I","Alt <","Alt >","Alt N","Alt V","Alt G","Alt H","Alt J","Host hotkeys are:","Alt S","Alt P","Alt T","Alt E","Alt K","Alt M","Alt Q","Alt A","Alt D","Alt F","Alt R"];
  3089.  
  3090. scope.adv_help = {"help":"Shows all command names.",
  3091. "?":"Shows all command names.",
  3092. "advhelp":"Shows a command in detail.",
  3093. "space":"Toggles space. When space is on, whatever you type will be spaced apart.",
  3094. "rcaps":"Toggles rcaps. When rcaps is on, each letter will randomly get capitalized.",
  3095. "number":"Toggles number. When number is on, 'a' becomes 4, 'e' becomes 3, 's' becomes 5, 'o' becomes 0, 'l' and 'i' become 1.",
  3096. "speech":"Turns on text to speech for the chat.",
  3097. "savedroom":"Displays all the rooms you have saved, you can remove individual ones from the saved rooms by clicking \"Remove\".",
  3098. "clearsavedroom":"Clears all the saved rooms.",
  3099. "echo":"Echoes a username. It copies the username's chat messages.",
  3100. "echotext":"Sets a message when someone who is echoed chats. \"message\" will get replaced by the person's message. \"username\" will get replaced by the person's username.",
  3101. "remove":"Removes username from echo list. You will not echo that username anymore.",
  3102. "clearecho":"Clears echo list. You will not echo anyone anymore.",
  3103. "chatw":"It private chats with username. Type /msg to message that username.",
  3104. "msg":"Messages with what username you are chatting with. Type /chatw to chat with a username.",
  3105. "ignorepm":"Ignores the username's private chat messages. To unignore, type '/ignorepm [username]'.",
  3106. "pmusers":"Dispays who you can private chat with.",
  3107. "pollstat":"Displays the current poll and its votes.",
  3108. "eval":"Evaluates code. Only use this if you are experienced in javascript.",
  3109. "debugger":"Opens debugger.",
  3110. "randomchat":"Spams random chat messages from the past.",
  3111. "lobby":"Makes lobby visible when you are ingame. Type '/lobby' again to close lobby.",
  3112. "score":"Displays the current score while ingame. Type '/score' again to hide the score.",
  3113. "team":"Joins a specific team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  3114. "scroll":"Toggles a scrollbar in ingame chat.",
  3115. "followcam":"Enables follow camera. Your character will be centered on the screen.",
  3116. "autocam":"Zooms in/out enough for you to see everyone on the screen.",
  3117. "zoom":"Zooms in, out, or resets zoom.",
  3118. "xray":"Removes all shapes that don't have a shadow. This means all non-physics shapes will be hidden.",
  3119. "aimbot":"Toggles aimbot. Aimbot will aim for you in arrows or death arrows mode.",
  3120. "heavybot":"Enables heavy bot. Heavy bot will heavy right before collision. Turn this off when player collision is off, because heavy bot will still function.",
  3121. "still":"Saves your position, and tries to reach it constantly. This is useful in parkour if you want to go afk.",
  3122. "lagbot":"Makes your movements very laggy. Type '/lagbot 0' to turn it off.",
  3123. "hidechat":"Hides ingame chat. Type '/showchat' to show it again.",
  3124. "showchat":"Shows ingame chat. '/hidechat' hides the chat.",
  3125. "notify":"You will be notified if a person types @username",
  3126. "stopnotify":"You will not be notified if a person types @username",
  3127. "support":"Displays all the people who have supported this mod.",
  3128. "startqp":"Starts cycling maps in your map menu.",
  3129. "stopqp":"Stops cycling maps in your map menu.",
  3130. "revqp":"Reverses the order of quickplay. '/next', '/previous' will be inverted.",
  3131. "pauseqp":"Only pauses or unpauses the quickplay cycle due to round end. '/next', '/previous' still work. Type 'pauseqp' to unpause quickplay.",
  3132. "next":"Skips the map. Usable only with '/startqp'.",
  3133. "nextafter":"Skips the map if no one is able to win/draw within a certain amount of time.",
  3134. "previous":"Goes to previous map. Usable only with '/startqp'.",
  3135. "shuffle":"Makes quickplay play random maps instead of in order.",
  3136. "freejoin":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing.",
  3137. "recmode":"In quickplay, it switches mode to recommended mode, according to editor.",
  3138. "recteam":"In quickplay, it sorts people into teams when teams are necessary.",
  3139. "defaultmode":"Switches mode to defaultmode if there is no recmode.",
  3140. "start":"Starts game instantly.",
  3141. "instaqp":"Rounds will instantly start without a countdown.",
  3142. "balanceA":"Balances everyone with balance number.",
  3143. "moveA":"Sets everyones team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  3144. "jointeam":"Sets the team of anyone who joins. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  3145. "moveT":"Sets everyone in one team to another team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  3146. "rounds":"Sets rounds to win.",
  3147. "replay":"Replays the movements that were recorded",
  3148. "record":"Records movements of the username",
  3149. "delrecording":"Deletes the recording with the name.",
  3150. "saverecording":"Saves the recording with the name.",
  3151. "loadrecording":"Loads the recording with the name. Type '/replay' to replay it.",
  3152. "stoprecord":"Stops recording the player. Type '/saverecording [text]' to save it.",
  3153. "jukebox":"Sets the jukebox to a link. That link will play for everyone who has this mod.",
  3154. "volume":"Sets the volume of the jukebox.",
  3155. "pausejukebox":"If the jukebox is playing, it pauses it.",
  3156. "resetjukebox":"Resets the jukebox, so it starts from the very beginning.",
  3157. "playjukebox":"If the jukebox is paused, it plays it.",
  3158. "roundsperqp":"After that many rounds, the map will change. Normally, the map will change after 1 round.",
  3159. "autorecord":"After a round ends, automatically records the last 15 seconds.",
  3160. "mode":"If host, switches mode. Otherwise, it requests the host to switch mode, as long as the host has this mod.",
  3161. "disablekeys":"If anyone presses a disabled key, they get killed. Key options: left right up down heavy special.",
  3162. "jointext":"Chats the jointext whenever someone joins. \"username\" will get replaced by the joining person's username.",
  3163. "wintext":"Chats the wintext whenever someone wins. \"username\" will get replaced by the winning person's username.",
  3164. "afkkill":"If a person stays afk for that many seconds, they get automatically killed.",
  3165. "ban":"Bans username from lobby. If they rejoin, it automatically bans.",
  3166. "kill":"Kills the person ingame.",
  3167. "resetpoll":"Clears the poll.",
  3168. "addoption":"Adds the option to the poll. You can only have 4 maximum options. Type '/deloption [letter]' to remove an option.",
  3169. "deloption":"Removes the option with that letter.",
  3170. "startpoll":"Starts a poll that lasts for at least 10 seconds. Type '/endpoll' to end it early.",
  3171. "endpoll":"Ends the poll early if the poll lasted for at least 10 seconds.",
  3172. "addplayer":"In sandbox, it adds bots.",
  3173. "addname":"Adds a bot with a specific name. If that name already exists, it will copy the skin of that player to the bot.",
  3174. "delplayer":"In sandbox, it deletes bots.",
  3175. "copy":"In sandbox, it makes all bots copy the username's movements.",
  3176. "sandbox":"Turns a normal lobby into a sandbox lobby. You cannot turn a sandbox lobby back into a normal lobby.",
  3177. "autokick":"Automatically kicks everyone who is not using this mod.",
  3178. "autoban":"Automatically bans everyone who is not using this mod.",
  3179. "Alt L":"Makes lobby visible when you are ingame. Press Alt L again to close lobby.",
  3180. "Alt C":"Hides ingame chat. Press Alt C again to show ingame chat.",
  3181. "Alt S":"Starts game instantly.",
  3182. "Alt T":"Toggles teams.",
  3183. "Alt N":"Enables follow camera. Your character will be centered on the screen.",
  3184. "Alt G":"Zooms in.",
  3185. "Alt H":"Resets zoom.",
  3186. "Alt J":"Zooms out.",
  3187. "Alt Y":"Enables xray. Removes all shapes that don't have a shadow. This means all non-physics shapes will be hidden.",
  3188. "Alt E":"Toggles editor.",
  3189. "Alt K":"Exits ingame and returns to lobby.",
  3190. "Alt M":"Switches modes.",
  3191. "Alt V":"Toggles autocam. Autocam zooms in/out enough for you to see everyone on the screen.",
  3192. "Alt Q":"Toggles quickplay.",
  3193. "Alt B":"Displays the current score while ingame. Press Alt B again to hide the score.",
  3194. "Alt A":"Skips the map if quickplay is on.",
  3195. "Alt D":"Goes to previous map if quickplay is on.",
  3196. "Alt F":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing.",
  3197. "Alt O":"Enables heavy bot. Heavy bot will heavy right before collision. Turn this off when player collision is off, because heavy bot will still function.",
  3198. "Alt U":"Toggles aimbot. Aimbot will aim for you in arrows or death arrows mode.",
  3199. "Alt P":"Only pauses or unpauses the quickplay cycle due to round end. '/next', '/previous' still work. Type 'pauseqp' to unpause quickplay.",
  3200. "Alt R":"In quickplay, it switches mode to recommended mode, according to editor.",
  3201. "Alt I":"Opens debugger.",
  3202. "Alt <":"Lowers ingame chat height.",
  3203. "Alt >":"Highers ingame chat height."
  3204. };
  3205. scope.displayadvhelp = function(command){
  3206. displayInChat(adv_help[command],"#009398","#DA0808",{sanitize:true},"",true);
  3207. };
  3208. scope.changemode = function(mode){
  3209. SEND('42[20,{"ga":"b","mo":"'+mode+'"}]');
  3210. RECIEVE('42[26,"b","'+mode+'"]');
  3211. };
  3212. Gdocument.getElementById("ingamechatcontent").style["pointer-events"]="all";
  3213. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  3214. Gdocument.getElementById("ingamechatcontent").style["height"]=chatheight.toString()+"px";
  3215. Gdocument.getElementById("ingamechatbox").style["height"]="100%";
  3216.  
  3217. document.getElementById('adboxverticalCurse').style["display"] = "none";
  3218. document.getElementById('adboxverticalleftCurse').style["display"] = "none";
  3219. elem.onclick=function(e){
  3220. if(stopquickplay==0 && ishost == true && e.isTrusted == true){
  3221. quicki = (Array.from(e.target.parentElement.parentNode.children).indexOf(e.target.parentNode)-1)%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  3222. if(reverseqp){
  3223. quicki+=2;
  3224. quicki = quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  3225. }
  3226. }
  3227. };
  3228. scope.urlify = function(text) {
  3229. if(!Gdocument.getElementById('bl_Menu')){
  3230. return text.replace(/(((https?:\/\/)|(www\.))[^\s]+)|(((http?:\/\/)|(www\.))[^\s]+)/g, function(url) {
  3231. if(url.startsWith('https://') || url.startsWith('http://')){return '<a href="' + url + '" target="_blank" style = "color:orange">' + url + '</a>';}
  3232. else{return '<a href="https://' + url + '" target="_blank" style = "color:orange">' + url + '</a>';}
  3233. })}return text;
  3234. };
  3235.  
  3236. scope.fire = function(type,options,d = Gdocument){
  3237. var event= document.createEvent("HTMLEvents");
  3238. event.initEvent(type,true,false);
  3239. for(var p in options){
  3240. event[p]=options[p];
  3241. }
  3242. d.dispatchEvent(event);
  3243. };
  3244.  
  3245. scope.chat = function(message){
  3246. SEND('42[10,{"message":'+JSON.stringify(message)+'}]');
  3247. };
  3248. scope.chat2 = function(message,enteragain=false){
  3249. mess = Gdocument.getElementById("newbonklobby_chat_input").value;
  3250. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  3251. Gdocument.getElementById("newbonklobby_chat_input").value = message;
  3252. Gdocument.getElementById("ingamechatinputtext").value = message;
  3253. fire("keydown",{keyCode:13});
  3254. if(!enteragain){
  3255. fire("keydown",{keyCode:13});
  3256. }
  3257. Gdocument.getElementById("newbonklobby_chat_input").value = mess;
  3258. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  3259. };
  3260. scope.displayInChat = function(message, LobbyColor, InGameColor, options, message2, BringDown) {
  3261. options = options ?? {};
  3262. BringDown = BringDown ?? false;
  3263. message2 = message2 ?? "";
  3264. LobbyColor = LobbyColor ?? "#8800FF";
  3265. InGameColor = InGameColor ?? "#AA88FF";
  3266. let A = Gdocument.createElement("div");
  3267. let B = Gdocument.createElement("span");
  3268. B.className = "newbonklobby_chat_status";
  3269. B.style.color = LobbyColor;
  3270. A.appendChild(B);
  3271. B.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  3272. B.innerHTML+=urlify(message2.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;'));
  3273. let C = Gdocument.createElement("div");
  3274. let D = Gdocument.createElement("span");
  3275. D.style.color = InGameColor;
  3276. C.appendChild(D);
  3277. D.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  3278. D.innerHTML+=urlify(message2.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;'));
  3279. let a = BringDown;
  3280. if(Gdocument.getElementById("newbonklobby_chat_content").clientHeight + Gdocument.getElementById("newbonklobby_chat_content").scrollTop >= Gdocument.getElementById("newbonklobby_chat_content").scrollHeight-1) {
  3281. a = true;
  3282. }
  3283. A.style["parsed"] = true;
  3284. C.style["parsed"] = true;
  3285. Gdocument.getElementById("newbonklobby_chat_content").appendChild(A);
  3286. Gdocument.getElementById("ingamechatcontent").appendChild(C);
  3287. if (a) { Gdocument.getElementById("newbonklobby_chat_content").scrollTop = Number.MAX_SAFE_INTEGER;};
  3288. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  3289. if(Gdocument.getElementById("newbonklobby_chat_input").style["pointer-events"]!="auto" && !Gdocument.getElementById("ingamechatinputtext").classList.value.includes("ingamechatinputtextbg")){
  3290. chat2("");
  3291. }
  3292. };
  3293.  
  3294. scope.lobby = function(){
  3295. if (Gdocument.getElementById("newbonklobby").style["display"]=="none"){
  3296.  
  3297. Gdocument.getElementById("newbonklobby_editorbutton").click();
  3298. Gdocument.getElementById("mapeditor_close").click();
  3299. if(Gdocument.getElementById("newbonklobby_playerbox_elementcontainer").children.length+Gdocument.getElementById("newbonklobby_specbox_elementcontainer").children.length-3>0){
  3300. Gdocument.getElementById("newbonklobby").style["z-index"]=1;
  3301. Gdocument.getElementById("maploadwindowcontainer").style["z-index"]=1;
  3302. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=1;
  3303. Gdocument.getElementById("pretty_top").style["z-index"]=3;
  3304. Gdocument.getElementById("settingsContainer").style["z-index"]=3;
  3305. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=3;
  3306. Gdocument.getElementById("hostleaveconfirmwindow").style["z-index"]=3;
  3307. debuggermenu.style["z-index"] = 2;
  3308. }
  3309. else{
  3310. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  3311. Gdocument.getElementById("newbonklobby").style["display"]="none";
  3312. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  3313.  
  3314. }
  3315.  
  3316. }
  3317. else if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  3318. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  3319. Gdocument.getElementById("newbonklobby").style["display"]="none";
  3320. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  3321.  
  3322. }
  3323. };
  3324.  
  3325. scope.lastmessage = function(){
  3326. if(Gdocument.getElementById("newbonklobby_chat_content").children.length!=0){
  3327. var lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  3328. var lm2 = "";
  3329. for(var i = 0; i<lm.length;i++){
  3330. lm2+=" "+lm[i].textContent.trim();
  3331. }
  3332. lm2 = lm2.trim();
  3333. if(lm2.startsWith("*")){
  3334. return lm2;
  3335. }
  3336. }
  3337. if(Gdocument.getElementById("ingamechatcontent").children.length!=0){
  3338. var lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  3339. var lm2 = "";
  3340. for(var i = 0; i<lm.length;i++){
  3341. lm2+=" "+lm[i].textContent.trim();
  3342. }
  3343. return lm2.trim();
  3344. }
  3345. return "";
  3346.  
  3347. };
  3348. scope.map = function(e,t=timedelay){
  3349. if(e<0){
  3350. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  3351. quicki = 0;
  3352. return;
  3353. }
  3354. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  3355. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  3356. return;
  3357. }
  3358.  
  3359. setTimeout(function(){if(!canceled){
  3360. startedinqp = true;
  3361. if(roundsperqp2>=roundsperqp){
  3362. roundsperqp2 = 0;
  3363. }
  3364. gameStartTimeStamp = Date.now();
  3365. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  3366. Gdocument.getElementById("newbonklobby_editorbutton").click();
  3367. if(recmodebool && ishost){
  3368. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  3369. if(mode == "" && defaultmode!="d"){
  3370. mode = defaultmode;
  3371. }
  3372. if(mode != ""){
  3373. RECIEVE('42[26,"b","'+mode+'"]');
  3374. }
  3375. }
  3376. var displayblock = Gdocument.getElementById("newbonklobby").style["display"] == "block";
  3377. Gdocument.getElementById("mapeditorcontainer").style["display"] = "none";
  3378. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  3379. if(displayblock){
  3380. Gdocument.getElementById("newbonklobby").style["display"] = "block";
  3381. }
  3382. Gdocument.getElementById("mapeditor_midbox_testbutton").click();}
  3383. canceled = false;
  3384. transitioning = false;
  3385. },t);
  3386.  
  3387. };
  3388.  
  3389. scope.gotonextmap = function(e){
  3390. if(e<0){
  3391. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  3392. quicki = 0;
  3393. return;
  3394. }
  3395. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  3396. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  3397. return;
  3398. }
  3399. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  3400. Gdocument.getElementById("newbonklobby_editorbutton").click();
  3401. if(recmodebool && ishost){
  3402. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  3403. if(mode == "" && defaultmode!="d"){
  3404. mode = defaultmode;
  3405. }
  3406. if(mode != ""){
  3407. RECIEVE('42[26,"b","'+mode+'"]');
  3408. }
  3409. }
  3410. startedinqp = true;
  3411. if(roundsperqp2>=roundsperqp){
  3412. roundsperqp2 = 0;
  3413. }
  3414. gameStartTimeStamp = Date.now();
  3415. var displayblock = Gdocument.getElementById("newbonklobby").style["display"] == "block";
  3416. Gdocument.getElementById("mapeditorcontainer").style["display"] = "none";
  3417. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  3418. if(displayblock){
  3419. Gdocument.getElementById("newbonklobby").style["display"] = "block";
  3420. }
  3421. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  3422. Gdocument.getElementById("newbonklobby").style["visibility"] = "visible";
  3423. };
  3424. scope.commandhandle = function(chat_val){
  3425. if (chat_val.substring(1,6)=="echo " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  3426. if (chat_val.substring(6).replace(/^\s+|\s+$/g, '')==username){
  3427. displayInChat("You cannot echo yourself.","#DA0808","#1EBCC1");
  3428. return "";
  3429. }
  3430. else if (echo_list.indexOf(chat_val.substring(6).replace(/^\s+|\s+$/g, ''))===-1) {
  3431.  
  3432. echo_list.push(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  3433. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is being echoed.","#DA0808","#1EBCC1");
  3434. return "";
  3435. }
  3436. else{
  3437. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is already being echoed.","#DA0808","#1EBCC1");
  3438. return "";
  3439. }
  3440. }
  3441. else if (chat_val.substring(1,8)=="remove " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  3442. if (echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, ''))!==-1){
  3443. echo_list.splice(echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, '')),1);
  3444. displayInChat(chat_val.substring(7).replace(/^\s+|\s+$/g, '')+" is not being echoed.","#DA0808","#1EBCC1");
  3445. return "";
  3446. }
  3447. else{
  3448. displayInChat("You cannot remove someone that you didn't echo.","#DA0808","#1EBCC1");
  3449. return "";
  3450. }
  3451.  
  3452. }
  3453. else if (chat_val.substring(1,10)=="echotext " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  3454. echotext = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  3455. displayInChat("Set echotext as: "+echotext,"#DA0808","#1EBCC1");
  3456. displayInChat("Type '/echotext' to reset echotext.","#DA0808","#1EBCC1");
  3457. return "";
  3458.  
  3459. }
  3460. else if (chat_val.substring(1,9)=="echotext"){
  3461. echotext = "message";
  3462. displayInChat("Reset echotext.","#DA0808","#1EBCC1");
  3463. return "";
  3464.  
  3465. }
  3466. else if (chat_val.substring(1,10)=="clearecho"){
  3467. echo_list = [];
  3468. displayInChat("Cleared the echo list.","#DA0808","#1EBCC1");
  3469. return "";
  3470. }
  3471. else if (chat_val.substring(1,11)=="randomchat"){
  3472. if(randomchat == true){
  3473. displayInChat("Random chat is now off.","#DA0808","#1EBCC1");
  3474. randomchat = false;
  3475. }
  3476. else{
  3477. displayInChat("Random chat is now on.","#DA0808","#1EBCC1");
  3478. randomchat = true;
  3479. }
  3480. return "";
  3481. }
  3482. else if (chat_val.substring(1,6)=="space"){
  3483. if(space_flag == true){
  3484. displayInChat("Space is now off.","#DA0808","#1EBCC1");
  3485. space_flag = false;
  3486. }
  3487. else{
  3488. displayInChat("Space is now on.","#DA0808","#1EBCC1");
  3489. space_flag = true;
  3490. }
  3491. return "";
  3492. }
  3493. else if (chat_val.substring(1,6)=="rcaps"){
  3494. if(rcaps_flag == true){
  3495. displayInChat("Rcaps is now off.","#DA0808","#1EBCC1");
  3496. rcaps_flag = false;
  3497. }
  3498. else{
  3499. displayInChat("Rcaps is now on.","#DA0808","#1EBCC1");
  3500. rcaps_flag = true;
  3501. }
  3502.  
  3503. return "";
  3504. }
  3505. else if (chat_val.substring(1,7)=="number"){
  3506. if(number_flag == true){
  3507. displayInChat("Number is now off.","#DA0808","#1EBCC1");
  3508. number_flag = false;
  3509. }
  3510. else{
  3511. displayInChat("Number is now on.","#DA0808","#1EBCC1");
  3512. number_flag = true;
  3513. }
  3514.  
  3515. return "";
  3516. }
  3517. else if (chat_val.substring(1,8)=="reverse"){
  3518. if(reverse_flag == true){
  3519. displayInChat("Reverse is now off.","#DA0808","#1EBCC1");
  3520. reverse_flag = false;
  3521. }
  3522. else{
  3523. displayInChat("Reverse is now on.","#DA0808","#1EBCC1");
  3524. reverse_flag = true;
  3525. }
  3526.  
  3527. return "";
  3528. }
  3529. else if (chat_val.substring(1,7)=="speech"){
  3530. if(text2speech == true){
  3531. displayInChat("Text to speech is now off.","#DA0808","#1EBCC1");
  3532. text2speech = false;
  3533. }
  3534. else{
  3535. displayInChat("Text to speech is now on.","#DA0808","#1EBCC1");
  3536. text2speech = true;
  3537. }
  3538.  
  3539. return "";
  3540. }
  3541. else if (chat_val.substring(1,6)=="eval " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  3542. var ev = "";
  3543. try{
  3544. ev = eval(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  3545. }
  3546. catch(e){
  3547. displayInChat(e.message,"#DA0808","#1EBCC1");
  3548. }
  3549. try{
  3550. displayInChat(ev.toString(),"#DA0808","#1EBCC1");
  3551. }
  3552. catch{
  3553. }
  3554.  
  3555. return "";
  3556.  
  3557. }
  3558. else if (chat_val.substring(1,10)=="savedroom"){
  3559. if(savedrooms.length == 0){
  3560. displayInChat("You do not have any saved rooms.","#DA0808","#1EBCC1");
  3561. return "";
  3562. }
  3563. else{
  3564. var keys = Object.keys(savedroomsdata);
  3565. for(var i = 0;i<keys.length;i++){
  3566. var code = 'this.parentElement.remove();delete Gwindow.savedroomsdata["'+keys[i]+'"];Gwindow.savedrooms.splice(Gwindow.savedrooms.indexOf('+keys[i]+'),1);';
  3567. displayInChat('<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">Remove</a>'+' - ',"#DA0808","#1EBCC1",{sanitize:false},JSON.stringify(savedroomsdata[keys[i]].roomname)+" - "+savedroomsdata[keys[i]].players+"/"+savedroomsdata[keys[i]].maxplayers+" players.");
  3568.  
  3569. Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true;
  3570. Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true;
  3571. Laster_message = lastmessage();
  3572. }
  3573. }
  3574. return "";
  3575. }
  3576. else if (chat_val.substring(1,15)=="clearsavedroom"){
  3577. if(savedrooms.length == 0){
  3578. displayInChat("You do not have any saved rooms.","#DA0808","#1EBCC1");
  3579. return "";
  3580. }
  3581. else{
  3582. var keys = Object.keys(savedroomsdata);
  3583. for(var i = 0;i<keys.length;i++){
  3584. savedrooms.splice(savedrooms.indexOf(parseInt(keys[i])),1);
  3585. delete savedroomsdata[keys[i]];
  3586. }
  3587. }
  3588. return "";
  3589. }
  3590. else if (chat_val.substring(1,10)=="followcam"){
  3591. if(FollowCam == true){
  3592. displayInChat("Follow Camera is now off.","#DA0808","#1EBCC1");
  3593. FollowCam = false;
  3594. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  3595. var addto = {"children":[]};
  3596. for(var i = 0;i<parentDraw.children.length;i++){
  3597. if(parentDraw.children[i].constructor.name == "e"){
  3598. addto = parentDraw.children[i];
  3599. break;
  3600. }
  3601. }
  3602. var canv = 0;
  3603. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  3604. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  3605. canv = Gdocument.getElementById("gamerenderer").children[i];
  3606. break;
  3607. }
  3608. }
  3609. var width = parseInt(canv.style["width"]);
  3610. var height = parseInt(canv.style["height"]);
  3611. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  3612. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  3613. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  3614. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  3615. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999){
  3616. pixiCircle.visible = false;
  3617. }
  3618. else{
  3619. pixiCircle.visible = true;
  3620. }
  3621. }
  3622. }
  3623. else{
  3624. displayInChat("Follow Camera is now on.","#DA0808","#1EBCC1");
  3625. FollowCam = true;
  3626. }
  3627.  
  3628. return "";
  3629. }
  3630. else if (chat_val.substring(1,8)=="autocam"){
  3631. if(autocam == true){
  3632. displayInChat("Auto Cam is now off.","#DA0808","#1EBCC1");
  3633. autocam = false
  3634. }
  3635. else{
  3636. displayInChat("Auto Cam is now on.","#DA0808","#1EBCC1");
  3637. autocam = true;
  3638. }
  3639.  
  3640. return "";
  3641. }
  3642. else if (chat_val.substring(1,7)=="aimbot"){
  3643. if(aimbot == true){
  3644. displayInChat("Aimbot is now off.","#DA0808","#1EBCC1");
  3645. aimbot = false;
  3646. }
  3647. else{
  3648. displayInChat("Aimbot is now on.","#DA0808","#1EBCC1");
  3649. aimbot = true;
  3650. getplayerkeys();
  3651. }
  3652.  
  3653. return "";
  3654. }
  3655. else if (chat_val.substring(1,8)=="volume " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  3656. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  3657. if(!isNaN(parseInt(text))){
  3658. int_text = parseInt(text);
  3659. if(int_text>=0 && int_text<=100){
  3660. jukeboxplayer.volume = int_text/100;
  3661. jukeboxplayervolume = int_text;
  3662. displayInChat("Jukebox volume set to: "+int_text.toString()+" percent.","#DA0808","#1EBCC1");
  3663. }
  3664. else{
  3665. displayInChat("Volume must be between 0 and 100 percent.","#DA0808","#1EBCC1");
  3666. }
  3667. }
  3668. return "";
  3669. }
  3670. else if (chat_val.substring(1,6)=="still"){
  3671. if(staystill == true){
  3672. displayInChat("Still is now off.","#DA0808","#1EBCC1");
  3673. staystill = false;
  3674. staystillpos = [0,0];
  3675. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  3676. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  3677. }
  3678. else{
  3679. if(playerids[myid].playerData?.transform){
  3680. displayInChat("Still is now on.","#DA0808","#1EBCC1");
  3681. staystill = true;
  3682. staystillpos = [playerids[myid].playerData.transform.position.x/scale,playerids[myid].playerData.transform.position.y/scale];
  3683. getplayerkeys();
  3684. fire("keyup",{"keyCode":leftRight[0]},Gdocument.getElementById("gamerenderer"));
  3685. fire("keyup",{"keyCode":leftRight[1]},Gdocument.getElementById("gamerenderer"));
  3686. }
  3687. else{
  3688. displayInChat("You have to be alive to use this command.","#DA0808","#1EBCC1");
  3689. }
  3690. }
  3691.  
  3692. return "";
  3693. }
  3694. else if (chat_val.substring(1,9)=="heavybot"){
  3695. if(heavybot == true){
  3696. displayInChat("Heavy bot is now off.","#DA0808","#1EBCC1");
  3697. heavybot = false;
  3698. }
  3699. else{
  3700. displayInChat("Heavy bot is now on.","#DA0808","#1EBCC1");
  3701. heavybot = true;
  3702. getplayerkeys();
  3703. }
  3704.  
  3705. return "";
  3706. }
  3707. else if (chat_val.substring(1,5)=="xray"){
  3708. Gdocument.getElementById("pretty_top_settings").click();
  3709. Gdocument.getElementById("settings_close").click();
  3710. if(Gdocument.getElementById("settings_graphicsquality").value==1){
  3711. displayInChat("You must have medium or high quality enabled to use this feature.","#DA0808","#1EBCC1");
  3712. return "";
  3713. }
  3714.  
  3715.  
  3716. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  3717. var addto = {"children":[]};
  3718. for(var i = 0;i<parentDraw.children.length;i++){
  3719. if(parentDraw.children[i].constructor.name == "e"){
  3720. addto = parentDraw.children[i];
  3721. break;
  3722. }
  3723. }
  3724. var addto2 = {"children":[]};
  3725. for(var i = 0;i<addto.children.length;i++){
  3726. if(addto.children[i].constructor.name == "e"){
  3727. addto2 = addto.children[i];
  3728. break;
  3729. }
  3730. }
  3731. var checkxray = addto2.children[0];
  3732. var addto3 = addto2.children[0].children;
  3733. if(addto3.length==1){
  3734. checkxray = checkxray.children[0];
  3735. addto3 = addto3[0].children;
  3736. }
  3737. var xrayon = false;
  3738. if(checkxray.xrayon){
  3739. checkxray.xrayon = false;
  3740. xrayon = false;
  3741. }
  3742. else{
  3743. checkxray.xrayon = true;
  3744. xrayon = true;
  3745. }
  3746. if(xrayon){
  3747. displayInChat("Xray is now on.","#DA0808","#1EBCC1");
  3748. for(var i = 0;i<addto3.length;i++){
  3749. if(addto3[i].children.length>0){
  3750. for(var i3 = 0;i3<addto3[i].children.length;i3++){
  3751. addto3[i].children[i3].visible = false;
  3752. if(addto3[i].children[i3].children.length>0){
  3753. addto3[i].children[i3].visible = true;
  3754. }
  3755. }
  3756. }
  3757. }
  3758.  
  3759. }
  3760. else{
  3761. displayInChat("Xray is now off.","#DA0808","#1EBCC1");
  3762. for(var i = 0;i<addto3.length;i++){
  3763. for(var i2 = 0;i2<addto3[i].children.length;i2++){
  3764. addto3[i].children[i2].visible = true;
  3765. }
  3766. }
  3767. }
  3768. }
  3769.  
  3770. return "";
  3771. }
  3772. else if (chat_val.substring(1,6)=="zoom "){
  3773. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  3774. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  3775. var addto = 0;
  3776. for(var i = 0;i<parentDraw.children.length;i++){
  3777. if(parentDraw.children[i].constructor.name == "e"){
  3778. addto = parentDraw.children[i];
  3779. break;
  3780. }
  3781. }
  3782. var canv = 0;
  3783. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  3784. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  3785. canv = Gdocument.getElementById("gamerenderer").children[i];
  3786. break;
  3787. }
  3788. }
  3789. var width = parseInt(canv.style["width"]);
  3790. var height = parseInt(canv.style["height"]);
  3791. if(addto){
  3792. if(text == "in"){
  3793. zoom *= 1.1;
  3794. }
  3795. else if(text == "out"){
  3796. zoom /= 1.1;
  3797. }
  3798. else if(text == "reset"){
  3799. zoom = 1;
  3800. }
  3801. else{
  3802. displayInChat("Options for zooming:","#DA0808","#1EBCC1");
  3803. displayInChat("in","#DA0808","#1EBCC1");
  3804. displayInChat("out","#DA0808","#1EBCC1");
  3805. displayInChat("reset","#DA0808","#1EBCC1");
  3806. return "";
  3807. }
  3808. addto.scale.x=zoom;
  3809. addto.scale.y=zoom;
  3810. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  3811. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  3812. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  3813. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  3814. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999 && !FollowCam){
  3815. pixiCircle.visible = false;
  3816. }
  3817. else{
  3818. pixiCircle.visible = true;
  3819. }
  3820. }
  3821. }
  3822. return "";
  3823. }
  3824. else if (chat_val.substring(1,9)=="hidechat"){
  3825. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  3826. return "";
  3827. }
  3828. else if (chat_val.substring(1,9)=="showchat"){
  3829. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  3830. return "";
  3831. }
  3832. else if (chat_val.substring(1,6)=="score"){
  3833. var element = Gdocument.getElementById("ingamewinner_scores");
  3834. element.style["visibility"] = "visible";
  3835. if(element.style["opacity"]<1){
  3836. element.style["opacity"] = 1;
  3837. }
  3838. else{
  3839. element.style["opacity"] = 0;
  3840. }
  3841. return "";
  3842. }
  3843.  
  3844. else if (chat_val.substring(1,7)=="scroll"){
  3845. if(scroll==false){
  3846. scroll = true;
  3847. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="scroll";
  3848. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  3849. }
  3850. else if(scroll==true){
  3851. scroll = false;
  3852. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="hidden";
  3853. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  3854. }
  3855.  
  3856. return "";
  3857. }
  3858.  
  3859. else if (chat_val.substring(1,7)=="chatw "){
  3860. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  3861.  
  3862. if(username == text){
  3863. displayInChat("You cannot private chat with yourself.","#DA0808","#1EBCC1");
  3864. return "";
  3865. }
  3866. private_chat = text;
  3867.  
  3868. SEND("42"+JSON.stringify([4,{"type":"request public key","from":username,"to":private_chat}]));
  3869. request_public_key_time_stamp = Date.now();
  3870. 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);
  3871. return "";
  3872. }
  3873. else if (chat_val.substring(1,8)=="lagbot " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  3874. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  3875. if(!isNaN(parseInt(text))){
  3876. int_text = parseInt(text);
  3877. if(int_text == 0){
  3878. causelag = false;
  3879. causelag2 = 0;
  3880. displayInChat("Lagbot is now off.","#DA0808","#1EBCC1");
  3881. displayInChat("To enable lagbot, type '/lagbot [number]' with a number between 1 and 10.","#DA0808","#1EBCC1");
  3882. }
  3883. else if(int_text>0 && int_text<=10){
  3884. causelag = true;
  3885. causelag2 = 45*int_text;
  3886. displayInChat("Lagbot is now on with a lag setting of "+int_text.toString()+" (~"+(45*int_text).toString()+"MS).","#DA0808","#1EBCC1");
  3887. displayInChat("Type '/lagbot 0' to turn off lagbot.","#DA0808","#1EBCC1");
  3888. }
  3889. else{
  3890. displayInChat("To enable lagbot, type '/lagbot [number]' with a number between 1 and 10.","#DA0808","#1EBCC1");
  3891. displayInChat("Type '/lagbot 0' to turn off lagbot.","#DA0808","#1EBCC1");
  3892. }
  3893. }
  3894. return "";
  3895. }
  3896. else if (chat_val.substring(1,8)=="record " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  3897. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  3898. var keys = Object.keys(playerids);
  3899. var recordingid2 = -1;
  3900. for(var i = 0;i<keys.length;i++){
  3901. if(playerids[keys[i]].userName == text){
  3902. recordingid2 = keys[i];
  3903. }
  3904. }
  3905. if(recordingid2 == -1){
  3906. displayInChat("Player not found. Please type a valid username.","#DA0808","#1EBCC1");
  3907. return "";
  3908. }
  3909. else{
  3910. recording = true;
  3911. recordingid = recordingid2;
  3912. displayInChat(playerids[recordingid].userName+" is now being recorded.","#DA0808","#1EBCC1");
  3913. if(recordingdata.length>0){
  3914. displayInChat("Any unsaved recording data is now cleared.","#DA0808","#1EBCC1");
  3915. }
  3916. recordingdata = [];
  3917. }
  3918. return "";
  3919. }
  3920. else if (chat_val.substring(1,11)=="stoprecord"){
  3921. if(recording){
  3922. displayInChat(playerids[recordingid].userName+" is not being recorded anymore.","#DA0808","#1EBCC1");
  3923. displayInChat("Type '/saverecording [text]' to save this recording.","#DA0808","#1EBCC1");
  3924. recording = false;
  3925. recordingid = -1;
  3926. recordingdata[0][1] = 0;
  3927. }
  3928. else{
  3929. displayInChat("No one is being recorded.","#DA0808","#1EBCC1");
  3930. }
  3931. return "";
  3932. }
  3933. else if (chat_val.substring(1,15)=="saverecording " && chat_val.replace(/^\s+|\s+$/g, '').length>=16){
  3934. var text = chat_val.substring(15).replace(/^\s+|\s+$/g, '');
  3935. if(Object.keys(recorddata).includes(text)){
  3936. displayInChat("This recording already exists. Please use a different name or type '/delrecording "+text+"'.","#DA0808","#1EBCC1");
  3937. }
  3938. else if(recordingdata.length>0){
  3939. recorddata[text] = JSON.parse(JSON.stringify(recordingdata));
  3940. displayInChat("Recording saved as: "+text,"#DA0808","#1EBCC1");
  3941. }
  3942. else{
  3943. displayInChat("There is no recording data to save. Please record data using '/record [username]'","#DA0808","#1EBCC1");
  3944. }
  3945. return "";
  3946. }
  3947. else if (chat_val.substring(1,14)=="delrecording " && chat_val.replace(/^\s+|\s+$/g, '').length>=15){
  3948. var text = chat_val.substring(14).replace(/^\s+|\s+$/g, '');
  3949. if(Object.keys(recorddata).includes(text)){
  3950. displayInChat("Recording deleted.","#DA0808","#1EBCC1");
  3951. delete recorddata[text];
  3952. }
  3953. else{
  3954. displayInChat("This recording does not exist.","#DA0808","#1EBCC1");
  3955. }
  3956. return "";
  3957. }
  3958. else if (chat_val.substring(1,15)=="loadrecording " && chat_val.replace(/^\s+|\s+$/g, '').length>=16){
  3959. var text = chat_val.substring(15).replace(/^\s+|\s+$/g, '');
  3960. if(!Object.keys(recorddata).includes(text)){
  3961. displayInChat("This recording does not exist.","#DA0808","#1EBCC1");
  3962. }
  3963. else{
  3964. if(recordingdata.length>0){
  3965. displayInChat("Any unsaved recording data is now cleared.","#DA0808","#1EBCC1");
  3966. }
  3967. recordingdata = JSON.parse(JSON.stringify(recorddata[text]));
  3968. displayInChat("Recording data is now loaded.","#DA0808","#1EBCC1");
  3969. }
  3970. return "";
  3971. }
  3972. else if (chat_val.substring(1,7)=="replay"){
  3973. if(recording){
  3974. displayInChat(playerids[recordingid].userName+" is not being recorded anymore.","#DA0808","#1EBCC1");
  3975. displayInChat("Type '/saverecording [text]' to save this recording.","#DA0808","#1EBCC1");
  3976. recordingid = -1;
  3977. recording = false;
  3978. recordingdata[0][1] = 0;
  3979. }
  3980. setTimeout(function(){
  3981. replaynow = Date.now();
  3982. replaycounter = 0;
  3983. replaykeysheld = GET_KEYS(0);
  3984. replay();
  3985. },100);
  3986. return "";
  3987. }
  3988. else if (chat_val.substring(1,5)=="msg " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  3989. if(private_chat_public_key[1][0] != 0 && private_chat_public_key[1][1] != 0 && private_chat_public_key[0] == private_chat){
  3990. var text = chat_val.substring(5).replace(/^\s+|\s+$/g, '');
  3991. var password = [];
  3992. for(var i = 0;i<10;i++){
  3993. password.push(Math.floor(Math.random()*100+50));
  3994. }
  3995. var text2 = [];
  3996. for(var i = 0;i<text.slice(0,400).length ;i++){
  3997. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  3998. }
  3999. pmlastmessage = text.slice(0,400);
  4000. 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)}]));
  4001. displayInChat("> "+username+": ","#DA0808","#1EBCC1",{sanitize:false},text,false);
  4002. Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children[0].parentElement.style["parsed"] = true;
  4003. Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children[0].parentElement.style["parsed"] = true;
  4004. Laster_message = lastmessage();
  4005.  
  4006. }
  4007. return "";
  4008. }
  4009. else if (chat_val.substring(1,10)=="ignorepm " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  4010. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  4011. if(ignorepmlist.includes(text)){
  4012. var index = ignorepmlist.indexOf(text);
  4013. ignorepmlist.splice(index,1);
  4014. displayInChat("You are not ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  4015.  
  4016. }
  4017. else{
  4018. ignorepmlist.push(text);
  4019. displayInChat("You are now ignoring private messages from "+text+".","#DA0808","#1EBCC1");
  4020. }
  4021. return "";
  4022. }
  4023. else if (chat_val.substring(1,8)=="pmusers"){
  4024. pmusers = [];
  4025. SEND("42"+JSON.stringify([4,{"type":"request private chat users","from":username}]));
  4026. pmuserstimestamp = Date.now();
  4027. setTimeout(function(){if(pmusers.length == 0){displayInChat("You cannot private chat with anyone.","#DA0808","#1EBCC1");
  4028. }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);
  4029. return "";
  4030. }
  4031. else if (chat_val.substring(1,6)=="lobby"){
  4032. lobby();
  4033. return "";
  4034. }
  4035. else if (chat_val.substring(1,9)=="debugger"){
  4036. if(Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"] == "none"){
  4037. debuggeropen = true;
  4038. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="block";
  4039. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="none";
  4040. Gdocument.getElementById("ingamechatinputtext").style["display"] = "none";
  4041. }
  4042. else{
  4043. debuggeropen = false;
  4044. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="none";
  4045. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  4046. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";
  4047. }
  4048. return "";
  4049. }
  4050. else if (chat_val.substring(1,6)=="team " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  4051. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  4052. if(text == "r"){Gdocument.getElementById("newbonklobby_redbutton").click();}
  4053. else if(text == "g"){Gdocument.getElementById("newbonklobby_greenbutton").click();}
  4054. else if(text == "y"){Gdocument.getElementById("newbonklobby_yellowbutton").click();}
  4055. else if(text == "b"){Gdocument.getElementById("newbonklobby_bluebutton").click();}
  4056. else if(text == "s"){Gdocument.getElementById("newbonklobby_specbutton").click();}
  4057. else if(text == "f"){Gdocument.getElementById("newbonklobby_ffabutton").click();}
  4058. return "";
  4059. }
  4060. else if (chat_val.substring(1,7)=="notify"){
  4061. npermissions = 1;
  4062. return "";
  4063. }
  4064. else if (chat_val.substring(1,11)=="stopnotify"){
  4065. npermissions = 0;
  4066. return "";
  4067. }
  4068. else if (chat_val.substring(1,8)=="support"){
  4069. displayInChat("Thanks everyone for helping me make this mod - LEGENDBOSS123","#0000FF","#FFFFFF");
  4070. displayInChat("mastery3","#0000FF","#FFFFFF");
  4071. displayInChat("UnmatchedBracket aka Left Paren","#0000FF","#FFFFFF");
  4072. displayInChat("iNeonz","#0000FF","#FFFFFF");
  4073. return "";
  4074. }
  4075. else if (chat_val.substring(1,9)=="pollstat"){
  4076. if(pollactive[0] || pollactive2[0]){
  4077. var count = [0,0,0,0];
  4078. var keys = Object.keys(playerids);
  4079. for(var i = 0;i<keys.length;i++){
  4080. if(ishost){
  4081. if(playerids[keys[i]].vote.poll!=-1 && playerids[keys[i]].vote.poll<pollactive[3].length-1){
  4082. count[playerids[keys[i]].vote.poll]++;
  4083. }
  4084. }
  4085. else{
  4086. if(playerids[keys[i]].vote.poll!=-1 && playerids[keys[i]].vote.poll<pollactive2[2].length-1){
  4087. count[playerids[keys[i]].vote.poll]++;
  4088. }
  4089. }
  4090. }
  4091. for(var i = 0;i<count.length;i++){
  4092. if(count[i]>1){
  4093. displayInChat(count[i].toString()+" people voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  4094. }
  4095. if(count[i]==1){
  4096. displayInChat(count[i].toString()+" person voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  4097. }
  4098. }
  4099. if(ishost){
  4100. displayInChat("The poll will end in: "+((pollactive[2]-Date.now())/1000).toString()+" seconds.","#DA0808","#1EBCC1");
  4101. }
  4102. displayInChat("The poll is:","#DA0808","#1EBCC1");
  4103. if(ishost){
  4104. for(var i = 0;i<pollactive[3].length;i++){
  4105. displayInChat(letters[i]+") "+pollactive[3][i],"#DA0808","#1EBCC1");
  4106. }
  4107. }
  4108. else{
  4109. for(var i = 0;i<pollactive2[2].length;i++){
  4110. displayInChat(letters[i]+") "+pollactive2[2][i],"#DA0808","#1EBCC1");
  4111. }
  4112. }
  4113. }
  4114. else{
  4115. displayInChat("No poll has been started.","#DA0808","#1EBCC1");
  4116. if(ishost){
  4117. displayInChat("Type '/startpoll [seconds]' to start a poll.","#DA0808","#1EBCC1");
  4118. if(poll.length>0){
  4119. displayInChat("The poll is:","#DA0808","#1EBCC1");
  4120. for(var i = 0;i<poll.length;i++){
  4121. displayInChat(letters[i]+") "+poll[i],"#DA0808","#1EBCC1");
  4122. }
  4123. }
  4124. }
  4125. }
  4126. return "";
  4127. }
  4128. else if (chat_val.substring(1,5)=="help" || chat_val.substring(1,2)=="?"){
  4129. for(var i = 0;i<help.length;i++){
  4130. if(help[i].startsWith("/")){
  4131. var splitted = help[i].substring(1).split(" ");
  4132. var command = splitted[0];
  4133. var rest = "";
  4134. if(splitted.length>1){
  4135. rest = " "+splitted.slice(1).join(" ");
  4136. }
  4137. displayInChat("/"+'<a onclick = \'Gwindow.displayadvhelp("'+command+'");\' style = "color:green;" href = "javascript:void(0);">'+command+'</a>'+rest,"#DA0808","#1EBCC1",{sanitize:false},"",false);
  4138. }
  4139. else if(help[i].startsWith("Alt ")){
  4140. displayInChat('<a onclick = \'Gwindow.displayadvhelp("'+help[i]+'");\' style = "color:green;" href = "javascript:void(0);">'+help[i]+'</a>',"#DA0808","#1EBCC1",{sanitize:false},"",false);
  4141. }
  4142. else{
  4143. displayInChat(help[i],"#DA0808","#1EBCC1");
  4144. }
  4145.  
  4146. }
  4147. return "";
  4148. }
  4149. else if (chat_val.substring(1,9)=="advhelp " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  4150. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  4151. if(typeof(adv_help[text])!='undefined'){
  4152. displayInChat(adv_help[text],"#DA0808","#1EBCC1");
  4153. }
  4154. return "";
  4155. }
  4156. else if (chat_val.substring(1,6)=="mode " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  4157. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  4158. var mode = "";
  4159. var text2 = text;
  4160. if(text == "arrows"){
  4161. text2 = "Arrows";
  4162. mode = "ar";
  4163. }
  4164. else if(text == "death arrows"){
  4165. mode = "ard";
  4166. text2 = "Death Arrows";
  4167. }
  4168. else if(text == "grapple"){
  4169. mode = "sp";
  4170. text2 = "Grapple";
  4171. }
  4172. else if(text == "classic"){
  4173. mode = "b";
  4174. text2 = "Classic";
  4175. }
  4176. else{
  4177. displayInChat("Mode options:","#DA0808","#1EBCC1");
  4178. displayInChat("classic","#DA0808","#1EBCC1");
  4179. displayInChat("arrows","#DA0808","#1EBCC1");
  4180. displayInChat("death arrows","#DA0808","#1EBCC1");
  4181. displayInChat("grapple","#DA0808","#1EBCC1");
  4182. }
  4183. if(mode != ""){
  4184. if(ishost){
  4185. SEND('42[20,{"ga":"b","mo":"'+mode+'"}]');
  4186. RECIEVE('42[26,"b","'+mode+'"]');
  4187. displayInChat("Changed mode to "+text+".","#DA0808","#1EBCC1");
  4188. }
  4189. else{
  4190. if(playerids[myid].ratelimit.mode+1000<Date.now()){
  4191. playerids[myid].ratelimit.mode=Date.now();
  4192. SEND("42"+JSON.stringify([4,{"type":"request mode","from":username,"mode":mode}]));
  4193. var code = 'if(!Gwindow.ishost){Gwindow.displayInChat("You must be host to change the mode.","#DA0808","#1EBCC1",{sanitize:false},"",true)}else{Gwindow.changemode("'+mode+'")}';
  4194. displayInChat('> '+username+' requests [<a onclick = \''+code+'\' style = "color:green;" href = "javascript:void(0);">'+text2+'</a>]',"#DA0808","#1EBCC1",{sanitize:false}," mode.");
  4195.  
  4196. }
  4197. else{
  4198. displayInChat("You are requesting modes too quickly.","#DA0808","#1EBCC1");
  4199. }
  4200. }
  4201. }
  4202. return "";
  4203.  
  4204. }
  4205. else if(ishost){
  4206. if (chat_val.substring(1,11)=="nextafter " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  4207. var text = parseFloat(chat_val.substring(11).replace(/^\s+|\s+$/g, ''));
  4208. if(isNaN(text)){
  4209. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4210. return "";
  4211. }
  4212. else if(text<=0){
  4213. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4214. return "";
  4215. }
  4216. nextafter = text;
  4217. displayInChat("Set next after to: " + text.toString()+" seconds.","#DA0808","#1EBCC1");
  4218. displayInChat("Type '/nextafter' to reset next after.","#DA0808","#1EBCC1");
  4219. return "";
  4220.  
  4221. }
  4222. else if (chat_val.substring(1,10)=="nextafter"){
  4223. nextafter = 0;
  4224. displayInChat("Reset next after.","#DA0808","#1EBCC1");
  4225. return "";
  4226.  
  4227. }
  4228. else if (chat_val.substring(1,5)=="next" && stopquickplay == 0){
  4229. roundsperqp2 = 0;
  4230. if(shuffle){
  4231. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  4232. var available = [];
  4233. var availableindexes = [];
  4234. var notempty = false;
  4235. for(var i = 0; i<e.length;i++){
  4236. var a = false;
  4237. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  4238. available.push(a);
  4239. if(a){
  4240. availableindexes.push(i);
  4241. notempty = true;
  4242. }
  4243. }
  4244. if(notempty){
  4245.  
  4246. if(availableindexes.length!=1){
  4247. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  4248. }
  4249. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  4250. }
  4251. }
  4252. else{
  4253. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  4254. var available = [];
  4255. var availableindexes = [];
  4256. var notempty = false;
  4257. for(var i = 0; i<e.length;i++){
  4258. var a = false;
  4259. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  4260. available.push(a);
  4261. if(a){
  4262. availableindexes.push(i);
  4263. notempty = true;
  4264. }
  4265. }
  4266. if(notempty){
  4267. var above = [];
  4268. for(var i = 0;i<availableindexes.length;i++){
  4269. if(availableindexes[i]>quicki && !reverseqp){
  4270. above.push(availableindexes[i]);
  4271. }
  4272. else if(availableindexes[i]<quicki && reverseqp){
  4273. above.push(availableindexes[i])
  4274. }
  4275. }
  4276. if(above.length>0){
  4277. quicki = above[0];
  4278. if(reverseqp){
  4279. quicki = above[above.length-1];
  4280. }
  4281. }
  4282. else{
  4283. quicki = availableindexes[0];
  4284. if(reverseqp){
  4285. quicki = availableindexes[availableindexes.length-1];
  4286. }
  4287. }
  4288. }
  4289. }
  4290. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  4291. displayInChat("Switched to next map.","#DA0808","#1EBCC1");
  4292. return "";
  4293.  
  4294. }
  4295. else if (chat_val.substring(1,9)=="freejoin"){
  4296. if(freejoin == false){
  4297. freejoin = true;
  4298. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  4299.  
  4300. }
  4301. else{
  4302. freejoin = false;
  4303. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  4304. }
  4305.  
  4306. return "";
  4307.  
  4308. }
  4309. else if (chat_val.substring(1,8)=="instaqp"){
  4310. if(instaqp == false){
  4311. instaqp = true;
  4312. displayInChat("Instaqp is now on.","#DA0808","#1EBCC1");
  4313.  
  4314. }
  4315. else{
  4316. instaqp = false;
  4317. displayInChat("Instaqp is now off.","#DA0808","#1EBCC1");
  4318. }
  4319.  
  4320. return "";
  4321.  
  4322. }
  4323.  
  4324. else if (chat_val.substring(1,9)=="previous" && stopquickplay == 0){
  4325. roundsperqp2 = 0;
  4326. if(shuffle){
  4327. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  4328. var available = [];
  4329. var availableindexes = [];
  4330. var notempty = false;
  4331. for(var i = 0; i<e.length;i++){
  4332. var a = false;
  4333. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  4334. available.push(a);
  4335. if(a){
  4336. availableindexes.push(i);
  4337. notempty = true;
  4338. }
  4339. }
  4340. if(notempty){
  4341.  
  4342. if(availableindexes.length!=1){
  4343. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  4344. }
  4345. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  4346. }
  4347. }
  4348. else{
  4349. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  4350. var available = [];
  4351. var availableindexes = [];
  4352. var notempty = false;
  4353. for(var i = 0; i<e.length;i++){
  4354. var a = false;
  4355. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  4356. available.push(a);
  4357. if(a){
  4358. availableindexes.push(i);
  4359. notempty = true;
  4360. }
  4361. }
  4362. if(notempty){
  4363. var above = [];
  4364. for(var i = 0;i<availableindexes.length;i++){
  4365. if(availableindexes[i]<quicki && !reverseqp){
  4366. above.push(availableindexes[i]);
  4367. }
  4368. else if(availableindexes[i]>quicki && reverseqp){
  4369. above.push(availableindexes[i])
  4370. }
  4371. }
  4372. if(above.length>0){
  4373. quicki = above[above.length-1];
  4374. if(reverseqp){
  4375. quicki = above[0];
  4376. }
  4377. }
  4378. else{
  4379. quicki = availableindexes[availableindexes.length-1];
  4380. if(reverseqp){
  4381. quicki = availableindexes[0];
  4382. }
  4383. }
  4384. }
  4385. }
  4386. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  4387.  
  4388. displayInChat("Switched to previous map.","#DA0808","#1EBCC1");
  4389. return "";
  4390. }
  4391. else if (chat_val.substring(1,6)=="start" && chat_val.length == 6){
  4392. if(Gdocument.getElementById("mapeditorcontainer").style["display"]!="block"){
  4393. Gdocument.getElementById("newbonklobby_editorbutton").click();
  4394. }
  4395. if(recmodebool && ishost){
  4396. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  4397. if(mode == "" && defaultmode!="d"){
  4398. mode = defaultmode;
  4399. }
  4400. if(mode != ""){
  4401. RECIEVE('42[26,"b","'+mode+'"]');
  4402. }
  4403. }
  4404. Gdocument.getElementById("mapeditor_close").click();
  4405. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  4406. roundsperqp2 = 0;
  4407. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  4408.  
  4409. return "";
  4410. }
  4411.  
  4412. else if (chat_val.substring(1,8)=="startqp" && stopquickplay == 1){
  4413. stopquickplay = 0;
  4414. quicki = 0;
  4415. qppaused = false;
  4416. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  4417. return "";
  4418. }
  4419. else if (chat_val.substring(1,7)=="stopqp" && stopquickplay == 0){
  4420. stopquickplay = 1;
  4421. quicki = 0;
  4422. qppaused = false;
  4423. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  4424. return "";
  4425. }
  4426. else if (chat_val.substring(1,8)=="pauseqp" && stopquickplay == 0){
  4427. if(qppaused == false){
  4428. qppaused = true;
  4429. displayInChat("Paused quickplay.","#DA0808","#1EBCC1");
  4430. }
  4431. else{
  4432. qppaused = false;
  4433. displayInChat("Unpaused quickplay.","#DA0808","#1EBCC1");
  4434. }
  4435. return "";
  4436. }
  4437. else if (chat_val.substring(1,6)=="revqp" && stopquickplay == 0){
  4438. if(reverseqp == false){
  4439. reverseqp = true;
  4440. displayInChat("Reverseqp is now on..","#DA0808","#1EBCC1");
  4441. }
  4442. else{
  4443. reverseqp = false;
  4444. displayInChat("Reverseqp is now off.","#DA0808","#1EBCC1");
  4445. }
  4446. return "";
  4447. }
  4448. else if (chat_val.substring(1,9)=="jukebox " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  4449. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  4450. changeJukeboxURL(text);
  4451. SEND("42"+JSON.stringify([4,{"type":"video player","from":username,"url":text,"timestamp":Date.now(),"to":[-1]}]));
  4452. return "";
  4453. }
  4454. else if (chat_val.substring(1,13)=="pausejukebox"){
  4455. if(jukeboxplayer.src!="" && !jukeboxplayer.paused){
  4456. jukeboxplayer.pause();
  4457. SEND("42"+JSON.stringify([4,{"type":"video player","from":username,"url":"","timestamp":Date.now(),"to":[-1]}]));
  4458. displayInChat("Jukebox is now paused.","#DA0808","#1EBCC1");
  4459. }
  4460. return "";
  4461. }
  4462. else if (chat_val.substring(1,13)=="resetjukebox"){
  4463. if(jukeboxplayer.src!=""){
  4464. jukeboxplayer.currentTime = 0;
  4465. jukeboxplayer.play();
  4466. SEND("42"+JSON.stringify([4,{"type":"video player","from":username,"url":jukeboxplayerURL,"timestamp":Date.now(),"to":[-1]}]));
  4467. displayInChat("Jukebox has been reset.","#DA0808","#1EBCC1");
  4468. }
  4469. return "";
  4470. }
  4471. else if (chat_val.substring(1,12)=="playjukebox"){
  4472. if(jukeboxplayer.src!="" && jukeboxplayer.paused){
  4473. jukeboxplayer.play();
  4474. displayInChat("Jukebox is now playing.","#DA0808","#1EBCC1");
  4475. SEND("42"+JSON.stringify([4,{"type":"video player","from":username,"url":jukeboxplayerURL,"timestamp":Date.now()-jukeboxplayer.currentTime*1000,"to":[-1]}]));
  4476. }
  4477. return "";
  4478. }
  4479. else if (chat_val.substring(1,5)=="ban " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  4480. banned.push(chat_val.substring(5).replace(/^\s+|\s+$/g, ''));
  4481. displayInChat("Banned "+chat_val.substring(5).replace(/^\s+|\s+$/g, '')+".","#DA0808","#1EBCC1");
  4482. return "/kick '" + chat_val.substring(5).replace(/^\s+|\s+$/g, '') + "'";
  4483. }
  4484. else if (chat_val.substring(1,6)=="kill " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  4485. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  4486. var keys = Object.keys(playerids);
  4487. var killid = undefined;
  4488. for(var i = 0; i<keys.length; i++){
  4489. if(playerids[keys[i]].userName == text){
  4490. killid = keys[i];
  4491. }
  4492. }
  4493. if(typeof(killid)!="undefined" && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden" && !killedids.includes(killid)){
  4494. currentFrame = Math.floor((Date.now() - gameStartTimeStamp)/1000*30);
  4495. killedids.push(killid);
  4496. SEND('42[25,{"a":{"playersLeft":['+killid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  4497. RECIEVE('42[31,{"a":{"playersLeft":['+killid.toString()+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  4498. }
  4499. return "";
  4500. }
  4501. else if (chat_val.substring(1,10)=="balanceA " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  4502. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  4503. if(!isNaN(parseInt(text))){
  4504. if(parseInt(text)>=-100 && parseInt(text)<=100){
  4505. var keys = Object.keys(playerids);
  4506. for(var i = 0; i<keys.length;i++){
  4507. SEND('42[29,{"sid":'+keys[i]+',"bal":'+text+'}]');
  4508. RECIEVE('42[36,'+keys[i]+','+text+']');
  4509. }
  4510. }
  4511. }
  4512. return "";
  4513.  
  4514. }
  4515. else if (chat_val.substring(1,10)=="resetpoll"){
  4516. poll = [];
  4517. displayInChat("The poll has been reset.","#DA0808","#1EBCC1");
  4518. return "";
  4519. }
  4520. else if (chat_val.substring(1,11)=="addoption " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  4521. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  4522. if(text.length>50){
  4523. displayInChat("Your option is greater than 50 characters.","#DA0808","#1EBCC1");
  4524. return "";
  4525. }
  4526. if(poll.includes(text)){
  4527. displayInChat("This option already exists.","#DA0808","#1EBCC1");
  4528. }
  4529. else if(poll.length>=4){
  4530. displayInChat("Your poll already has the max 4 amounts of options.","#DA0808","#1EBCC1");
  4531. displayInChat("Type '/deloption [letter]' to remove a option.","#DA0808","#1EBCC1");
  4532. displayInChat("The poll is:","#DA0808","#1EBCC1");
  4533. for(var i = 0;i<poll.length;i++){
  4534. displayInChat(letters[i]+") "+poll[i],"#DA0808","#1EBCC1");
  4535. }
  4536. }
  4537. else{
  4538. poll.push(text);
  4539. displayInChat("The poll is now:","#DA0808","#1EBCC1");
  4540. for(var i = 0;i<poll.length;i++){
  4541. displayInChat(letters[i]+") "+poll[i],"#DA0808","#1EBCC1");
  4542. }
  4543. }
  4544. return "";
  4545. }
  4546. else if (chat_val.substring(1,11)=="deloption " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  4547. var text = letters.indexOf(chat_val.substring(11).replace(/^\s+|\s+$/g, ''));
  4548. if(text==-1 || text>=poll.length){
  4549. if(poll.length>0){
  4550. displayInChat("Available options are:","#DA0808","#1EBCC1");
  4551. for(var i = 0;i<poll.length;i++){
  4552. displayInChat(letters[i],"#DA0808","#1EBCC1");
  4553. }
  4554. }
  4555. else{
  4556. displayInChat("Your poll is empty.","#DA0808","#1EBCC1");
  4557. displayInChat("Type '/addoption [text]' to add an option.","#DA0808","#1EBCC1");
  4558. }
  4559. }
  4560. else{
  4561. poll.splice(text,1);
  4562. displayInChat("The poll is now:","#DA0808","#1EBCC1");
  4563. for(var i = 0;i<poll.length;i++){
  4564. displayInChat(letters[i]+") "+poll[i],"#DA0808","#1EBCC1");
  4565. }
  4566. }
  4567. return "";
  4568. }
  4569. else if (chat_val.substring(1,11)=="startpoll " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  4570. var text = parseFloat(chat_val.substring(11).replace(/^\s+|\s+$/g, ''));
  4571. if(isNaN(text)){
  4572. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4573. return "";
  4574. }
  4575. else if(text<=0){
  4576. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4577. return "";
  4578. }
  4579. else if(text<10){
  4580. displayInChat("Your poll has to last for at least 10 seconds.","#DA0808","#1EBCC1");
  4581. return "";
  4582. }
  4583. if(pollactive[0]){
  4584. displayInChat("There is already an ongoing poll.","#DA0808","#1EBCC1");
  4585. displayInChat("Type '/endpoll' to end the poll.","#DA0808","#1EBCC1");
  4586. return "";
  4587. }
  4588. if(poll.length<2){
  4589. displayInChat("Your poll needs at least 2 options.","#DA0808","#1EBCC1");
  4590. displayInChat("Type '/addoption' to add to the poll.","#DA0808","#1EBCC1");
  4591. return "";
  4592. }
  4593. var now = Date.now();
  4594. pollactive = [true,now,now+text*1000,[...poll]];
  4595. playerids[myid].ratelimit.poll = now;
  4596. var chatpoll = [...poll];
  4597. chatpoll.push("Cancel vote.");
  4598. pollactive[3].push("Cancel vote.");
  4599. for(var i = 0;i<chatpoll.length;i++){
  4600. chatpoll[i] = letters[i]+") "+chatpoll[i];
  4601. }
  4602. chat(chatpoll.join("     "));
  4603. setTimeout(function(){
  4604. if(pollactive[0]){
  4605. SEND("42"+JSON.stringify([4,{"type":"poll","from":username,"poll":pollactive[3]}]));
  4606. var keys = Object.keys(playerids);
  4607. for(var i = 0;i<keys.length;i++){
  4608. playerids[keys[i]].vote.poll = -1;
  4609. }
  4610. displayInChat("The poll will end in: " + text.toString()+" seconds.","#DA0808","#1EBCC1");
  4611. displayInChat("Type '/endpoll' to end the poll early.","#DA0808","#1EBCC1");
  4612. }
  4613. },200);
  4614. return "";
  4615. }
  4616. else if (chat_val.substring(1,8)=="endpoll"){
  4617. if(pollactive[0]){
  4618. if(playerids[myid].ratelimit.poll+10000>Date.now()){
  4619. displayInChat("Your poll has to be at least 10 seconds.","#DA0808","#1EBCC1");
  4620. displayInChat("There are "+((playerids[myid].ratelimit.poll+10000-Date.now())/1000).toString()+" seconds left until you can end the poll early.","#DA0808","#1EBCC1");
  4621. return "";
  4622. }
  4623. playerids[myid].ratelimit.poll = Date.now();
  4624. SEND("42"+JSON.stringify([4,{"type":"poll end","from":username}]));
  4625. displayInChat("The poll ended.","#DA0808","#1EBCC1");
  4626. var count = [0,0,0,0];
  4627. var keys = Object.keys(playerids);
  4628. for(var i = 0;i<keys.length;i++){
  4629. if(playerids[keys[i]].vote.poll!=-1 && playerids[keys[i]].vote.poll<pollactive[3].length-1){
  4630. count[playerids[keys[i]].vote.poll]++;
  4631. }
  4632. playerids[keys[i]].vote.poll = -1;
  4633. }
  4634. for(var i = 0;i<count.length;i++){
  4635. if(count[i]>1){
  4636. displayInChat(count[i].toString()+" people voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  4637. }
  4638. if(count[i]==1){
  4639. displayInChat(count[i].toString()+" person voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  4640. }
  4641. }
  4642. displayInChat("The poll was:","#DA0808","#1EBCC1");
  4643. for(var i = 0;i<pollactive[3].length;i++){
  4644. displayInChat(letters[i]+") "+pollactive[3][i],"#DA0808","#1EBCC1");
  4645. }
  4646. pollactive = [false,0,0,[]];
  4647. }
  4648. else{
  4649. displayInChat("No poll has been started","#DA0808","#1EBCC1");
  4650. displayInChat("Type '/startpoll [seconds]' to start a poll.","#DA0808","#1EBCC1");
  4651. }
  4652. return "";
  4653. }
  4654. else if (chat_val.substring(1,7)=="moveA " && chat_val.replace(/^\s+|\s+$/g, '').length>=8){
  4655. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  4656. var keys = Object.keys(playerids);
  4657. var t = -1;
  4658. if(text == "f"){
  4659. t = 1;
  4660. }
  4661. else if(text == "b"){
  4662. t = 3;
  4663. }
  4664. else if(text == "g"){
  4665. t = 4;
  4666. }
  4667. else if(text == "r"){
  4668. t = 2;
  4669. }
  4670. else if(text == "y"){
  4671. t = 5;
  4672. }
  4673. else if(text == "s"){
  4674. t = 0;
  4675. }
  4676. if(t == -1){
  4677. displayInChat("The format for this command is:","#DA0808","#1EBCC1");
  4678. displayInChat("/moveA [letter]","#DA0808","#1EBCC1");
  4679. displayInChat("For example: '/moveA r' would move everyone to red team.","#DA0808","#1EBCC1");
  4680. return "";
  4681. }
  4682. for(var i = 0;i<keys.length;i++){
  4683. SEND('42[26,{"targetID":'+keys[i].toString()+',"targetTeam":'+t.toString()+'}]');
  4684. if(playerids[keys[i]].peerID!="sandbox"){
  4685. RECIEVE('42[18,'+keys[i].toString()+','+t.toString()+']');
  4686. }
  4687. }
  4688. return "";
  4689. }
  4690. else if (chat_val.substring(1,7)=="moveT " && chat_val.replace(/^\s+|\s+$/g, '').length>=8){
  4691. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '').split(" ").filter(function(i){if(i==""){return false}else{return true}});
  4692. if(text.length == 2){
  4693. var firstteam = -1;
  4694. var secondteam = -1;
  4695. for(var i = 0;i<2;i++){
  4696. var t = -1;
  4697. if(text[i] == "f"){
  4698. t = 1;
  4699. }
  4700. else if(text[i] == "b"){
  4701. t = 3;
  4702. }
  4703. else if(text[i] == "g"){
  4704. t = 4;
  4705. }
  4706. else if(text[i] == "r"){
  4707. t = 2;
  4708. }
  4709. else if(text[i] == "y"){
  4710. t = 5;
  4711. }
  4712. else if(text[i] == "s"){
  4713. t = 0;
  4714. }
  4715. if(t==-1){
  4716. displayInChat("The format for this command is:","#DA0808","#1EBCC1");
  4717. displayInChat("/moveT [letter] [letter]","#DA0808","#1EBCC1");
  4718. displayInChat("For example: '/moveT s r' would move everyone in spectate to red team.","#DA0808","#1EBCC1");
  4719. return "";
  4720. }
  4721. else{
  4722. if(i == 0){
  4723. firstteam = t;
  4724. }
  4725. else{
  4726. secondteam = t;
  4727. }
  4728. }
  4729. }
  4730. var keys = Object.keys(playerids);
  4731. for(var i = 0;i<keys.length;i++){
  4732. if(playerids[keys[i]].team == firstteam){
  4733. SEND('42[26,{"targetID":'+keys[i].toString()+',"targetTeam":'+secondteam.toString()+'}]');
  4734. if(playerids[keys[i]].peerID!="sandbox"){
  4735. RECIEVE('42[18,'+keys[i].toString()+','+secondteam.toString()+']');
  4736. }
  4737. }
  4738. }
  4739. }
  4740. else{
  4741. displayInChat("The format for this command is:","#DA0808","#1EBCC1");
  4742. displayInChat("/moveT [team] [team]","#DA0808","#1EBCC1");
  4743. displayInChat("For example: '/moveT s r' would move everyone in spectate to red team.","#DA0808","#1EBCC1");
  4744. return "";
  4745. }
  4746. return "";
  4747. }
  4748. if (chat_val.substring(1,13)=="roundsperqp " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  4749. var text = parseInt(chat_val.substring(13).replace(/^\s+|\s+$/g, ''));
  4750. if(isNaN(text)){
  4751. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4752. return "";
  4753. }
  4754. else if(text<=0){
  4755. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4756. return "";
  4757. }
  4758. roundsperqp = text;
  4759. roundsperqp2 = 0;
  4760. displayInChat("Set rounds per quickplay to: " + text.toString(),"#DA0808","#1EBCC1");
  4761. displayInChat("Type '/roundsperqp' to reset rounds per quickplay.","#DA0808","#1EBCC1");
  4762. return "";
  4763.  
  4764. }
  4765. else if (chat_val.substring(1,12)=="roundsperqp"){
  4766. roundsperqp = 1;
  4767. roundsperqp2 = 0;
  4768. displayInChat("Reset rounds per quickplay.","#DA0808","#1EBCC1");
  4769. return "";
  4770.  
  4771. }
  4772. else if (chat_val.substring(1,8)=="rounds " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  4773. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  4774. if(!isNaN(parseInt(text))){
  4775. text = parseInt(text).toString();
  4776. SEND('42[21,{"w":'+text+'}]');
  4777. RECIEVE('42[27,'+text+']');
  4778. }
  4779. return "";
  4780.  
  4781. }
  4782. else if (chat_val.substring(1,13)=="disablekeys " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  4783. var text = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  4784. var keys = text.split(" ");
  4785. var disabledkeys2 = [];
  4786. var possiblekeys = ["left","right","up","down","heavy","special"];
  4787. for(var i = 0; i<keys.length; i++){
  4788. if(keys[i]!="" && !disabledkeys2.includes(keys[i])){
  4789. if(possiblekeys.includes(keys[i])){
  4790. disabledkeys2.push(keys[i]);
  4791. }
  4792. else{
  4793. displayInChat("Key options: " + possiblekeys.join(" ") + ".","#DA0808","#1EBCC1");
  4794. return "";
  4795. }
  4796. }
  4797. }
  4798. disabledkeys = disabledkeys2;
  4799. displayInChat("Set disabled keys to: " + disabledkeys.join(" ") + ".","#DA0808","#1EBCC1");
  4800. displayInChat("Type '/disablekeys' to reset disabled keys.","#DA0808","#1EBCC1");
  4801. return "";
  4802.  
  4803. }
  4804. else if (chat_val.substring(1,12)=="disablekeys"){
  4805. displayInChat("Reset disabled keys.","#DA0808","#1EBCC1");
  4806. disabledkeys = [];
  4807. return "";
  4808.  
  4809. }
  4810. else if (chat_val.substring(1,10)=="jointext " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  4811. jointext = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  4812. displayInChat("Set jointext to: " + jointext,"#DA0808","#1EBCC1");
  4813. displayInChat("Type '/jointext' to reset jointext.","#DA0808","#1EBCC1");
  4814. return "";
  4815.  
  4816. }
  4817. else if (chat_val.substring(1,9)=="jointext"){
  4818. jointext = "";
  4819. displayInChat("Reset jointext.","#DA0808","#1EBCC1");
  4820. return "";
  4821.  
  4822. }
  4823. else if (chat_val.substring(1,10)=="jointeam " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  4824. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  4825. var keys = Object.keys(playerids);
  4826. var t = -1;
  4827. if(text == "f"){
  4828. t = 1;
  4829. displayInChat("Set jointeam to FFA.","#DA0808","#1EBCC1");
  4830. }
  4831. else if(text == "b"){
  4832. t = 3;
  4833. displayInChat("Set jointeam to blue team.","#DA0808","#1EBCC1");
  4834. }
  4835. else if(text == "g"){
  4836. t = 4;
  4837. displayInChat("Set jointeam to green team.","#DA0808","#1EBCC1");
  4838. }
  4839. else if(text == "r"){
  4840. t = 2;
  4841. displayInChat("Set jointeam to red team.","#DA0808","#1EBCC1");
  4842. }
  4843. else if(text == "y"){
  4844. t = 5;
  4845. displayInChat("Set jointeam to yellow team.","#DA0808","#1EBCC1");
  4846. }
  4847. else if(text == "s"){
  4848. t = 0;
  4849. displayInChat("Set jointeam to spectate.","#DA0808","#1EBCC1");
  4850. }
  4851. if(t == -1){
  4852. displayInChat("The format for this command is:","#DA0808","#1EBCC1");
  4853. displayInChat("/jointeam [letter]","#DA0808","#1EBCC1");
  4854. displayInChat("For example: '/jointeam r' would move every joined person to red team.","#DA0808","#1EBCC1");
  4855. return "";
  4856. }
  4857. displayInChat("Type '/jointeam' to reset jointeam.","#DA0808","#1EBCC1");
  4858. jointeam = t;
  4859. return "";
  4860. }
  4861. else if (chat_val.substring(1,9)=="jointeam"){
  4862. jointeam = -1;
  4863. displayInChat("Reset jointeam.","#DA0808","#1EBCC1");
  4864. return "";
  4865.  
  4866. }
  4867. else if (chat_val.substring(1,9)=="wintext " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  4868. wintext = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  4869. displayInChat("Set wintext to: " + wintext,"#DA0808","#1EBCC1");
  4870. displayInChat("Type '/wintext' to reset wintext.","#DA0808","#1EBCC1");
  4871. return "";
  4872.  
  4873. }
  4874. else if (chat_val.substring(1,8)=="wintext"){
  4875. wintext = "";
  4876. displayInChat("Reset wintext.","#DA0808","#1EBCC1");
  4877. return "";
  4878.  
  4879. }
  4880. else if (chat_val.substring(1,11)=="autorecord"){
  4881. if(autorecord){
  4882. autorecord = false;
  4883. displayInChat("Autorecord is now off.","#DA0808","#1EBCC1");
  4884. }
  4885. else{
  4886. autorecord = true;
  4887. displayInChat("Autorecord is now on.","#DA0808","#1EBCC1");
  4888. }
  4889. return "";
  4890.  
  4891. }
  4892. else if (chat_val.substring(1,9)=="afkkill " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  4893. var text = parseFloat(chat_val.substring(9).replace(/^\s+|\s+$/g, ''));
  4894. if(!isNaN(text)){
  4895. if(text>0){
  4896. displayInChat("Set afk kill to: " + text.toString()+" seconds.","#DA0808","#1EBCC1");
  4897. displayInChat("Type '/afkkill' to reset afk kill.","#DA0808","#1EBCC1");
  4898. var keys = Object.keys(playerids);
  4899. var now = Date.now();
  4900. for(var i = 0;i<keys.length;i++){
  4901. playerids[keys[i]].lastmove = now;
  4902. }
  4903. afkkill = text;
  4904. }
  4905. else{
  4906. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4907. }
  4908. }
  4909. else{
  4910. displayInChat("Type a positive number.","#DA0808","#1EBCC1");
  4911. }
  4912. return "";
  4913.  
  4914. }
  4915. else if (chat_val.substring(1,9)=="afkkill"){
  4916. afkkill = -1;
  4917. displayInChat("Reset afk kill.","#DA0808","#1EBCC1");
  4918. return "";
  4919.  
  4920. }
  4921. else if (chat_val.substring(1,13)=="defaultmode " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  4922. var text = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  4923. if(text == "default"){
  4924. defaultmode = "";
  4925. displayInChat("Changed default mode to default.","#DA0808","#1EBCC1");
  4926. }
  4927. else if(text == "arrows"){
  4928. defaultmode = "ar";
  4929. displayInChat("Changed default mode to arrows.","#DA0808","#1EBCC1");
  4930. }
  4931. else if(text == "death arrows"){
  4932. defaultmode = "ard";
  4933. displayInChat("Changed default mode to death arrows.","#DA0808","#1EBCC1");
  4934. }
  4935. else if(text == "grapple"){
  4936. defaultmode = "sp";
  4937. displayInChat("Changed default mode to grapple.","#DA0808","#1EBCC1");
  4938. }
  4939. else if(text == "classic"){
  4940. defaultmode = "b";
  4941. displayInChat("Changed default mode to classic.","#DA0808","#1EBCC1");
  4942.  
  4943. }
  4944. else{
  4945. displayInChat("Default mode options:","#DA0808","#1EBCC1");
  4946. displayInChat("default","#DA0808","#1EBCC1");
  4947. displayInChat("classic","#DA0808","#1EBCC1");
  4948. displayInChat("arrows","#DA0808","#1EBCC1");
  4949. displayInChat("death arrows","#DA0808","#1EBCC1");
  4950. displayInChat("grapple","#DA0808","#1EBCC1");
  4951. }
  4952. return "";
  4953.  
  4954. }
  4955. else if (chat_val.substring(1,8)=="recmode"){
  4956. if(recmodebool == true){
  4957. recmodebool = false;
  4958. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  4959.  
  4960. }
  4961. else{
  4962. recmodebool = true;
  4963. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  4964.  
  4965. }
  4966.  
  4967. return "";
  4968.  
  4969. }
  4970. else if (chat_val.substring(1,8)=="recteam"){
  4971. if(recteams == true){
  4972. recteams = false;
  4973. displayInChat("Recteam is now off.","#DA0808","#1EBCC1");
  4974.  
  4975. }
  4976. else{
  4977. recteams = true;
  4978. displayInChat("Recteam is now on.","#DA0808","#1EBCC1");
  4979.  
  4980. }
  4981. return "";
  4982. }
  4983. else if (chat_val.substring(1,8)=="shuffle"){
  4984. if(shuffle == true){
  4985. shuffle = false;
  4986. displayInChat("Shuffle is now off.","#DA0808","#1EBCC1");
  4987.  
  4988. }
  4989. else{
  4990. shuffle = true;
  4991. displayInChat("Shuffle is now on.","#DA0808","#1EBCC1");
  4992.  
  4993. }
  4994.  
  4995. return "";
  4996.  
  4997. }
  4998. else if (chat_val.substring(1,9)=="autokick"){
  4999. if(autokickban == 0){
  5000. displayInChat("Autokick is now on.","#DA0808","#1EBCC1");
  5001. autokickban = 1;
  5002. }
  5003. else if(autokickban == 1){
  5004. autokickban = 0;
  5005. displayInChat("Autokick is now off.","#DA0808","#1EBCC1");
  5006. }
  5007. else{
  5008. autokickban = 1;
  5009. displayInChat("Autokick is now on, and Autoban is now off.","#DA0808","#1EBCC1");
  5010. }
  5011.  
  5012. return "";
  5013. }
  5014. else if (chat_val.substring(1,8)=="autoban"){
  5015. if(autokickban == 0){
  5016. displayInChat("Autoban is now on.","#DA0808","#1EBCC1");
  5017. autokickban = 2;
  5018. }
  5019. else if(autokickban == 2){
  5020. autokickban = 0;
  5021. displayInChat("Autoban is now off.","#DA0808","#1EBCC1");
  5022. }
  5023. else{
  5024. autokickban = 2;
  5025. displayInChat("Autoban is now on, and Autokick is now off.","#DA0808","#1EBCC1");
  5026. }
  5027.  
  5028. return "";
  5029. }
  5030. else if (chat_val.substring(1,8)=="sandbox"){
  5031. if(sandboxon == false){
  5032. displayInChat("This room is now a sandbox room.","#DA0808","#1EBCC1");
  5033. sandboxon = true;
  5034. SEND('42[4,{"type":"sandboxon"}]');
  5035. var sandboxkeys = Object.keys(sandboxplayerids);
  5036. var packets = [];
  5037. for(var i = 0;i<sandboxkeys.length;i++){
  5038. var p = playerids[sandboxkeys[i]];
  5039. var packet = '42'+JSON.stringify([4,sandboxkeys[i],p.peerID,p.userName,p.guest,p.level,p.team,p.avatar]);
  5040. packets.push(packet);
  5041. }
  5042. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":packets,to:[-1]}]));
  5043. SEND("42"+JSON.stringify([4,{"type":"sandboxid","from":username,"lastid":sandboxid,to:[-1]}]));
  5044. }
  5045. else{
  5046. displayInChat("You cannot turn a sandbox room back into a normal room.","#DA0808","#1EBCC1");
  5047. }
  5048.  
  5049. return "";
  5050. }
  5051. else if(sandboxon){
  5052. if (chat_val.substring(1,11)=="addplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  5053. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  5054. if(!isNaN(parseInt(text))){
  5055. var text2 = parseInt(text);
  5056. if(text2>0){
  5057. for(var i = 0;i<text2;i++){
  5058. while(playerids[sandboxid]){
  5059. sandboxid+=1;
  5060. }
  5061. var color = Math.floor(Math.random() * 16777215).toString();
  5062. var packet = '42'+JSON.stringify([4,sandboxid,"sandbox",sandboxid.toString(),true,0,0,{"layers":[],"bc":color}]);
  5063. RECIEVE(packet);
  5064. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet],to:[-1]}]));
  5065. sandboxplayerids[sandboxid] = sandboxid.toString();
  5066. sandboxid+=1;
  5067. }
  5068.  
  5069. }
  5070. }
  5071. return "";
  5072.  
  5073. }
  5074. if (chat_val.substring(1,9)=="addname " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  5075. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  5076. while(playerids[sandboxid]){
  5077. sandboxid+=1;
  5078. }
  5079. var keys = Object.keys(playerids);
  5080. var addon = "";
  5081. var escape = false;
  5082. var keysi = -1;
  5083. while(!escape){
  5084. escape = true;
  5085. for(var i = 0;i<keys.length;i++){
  5086. if(playerids[keys[i]].userName == text+addon){
  5087. addon+="‎";
  5088. var escape = false;
  5089. }
  5090. if(playerids[keys[i]].userName == text){
  5091. keysi = keys[i];
  5092. }
  5093. }
  5094. }
  5095. if(keysi!=-1){
  5096. var packet = '42'+JSON.stringify([4,sandboxid,"sandbox",text+addon,playerids[keysi].guest,playerids[keysi].level,0,playerids[keysi].avatar]);
  5097. RECIEVE(packet);
  5098. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet],to:[-1]}]));
  5099. }
  5100. else{
  5101. var color = Math.floor(Math.random() * 16777215).toString();
  5102. var packet = '42'+JSON.stringify([4,sandboxid,"sandbox",text+addon,true,0,0,{"layers":[],"bc":color}]);
  5103. RECIEVE(packet);
  5104. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":[packet],to:[-1]}]));
  5105. }
  5106. sandboxplayerids[sandboxid] = sandboxid.toString();
  5107. sandboxid+=1;
  5108. return "";
  5109.  
  5110. }
  5111. else if (chat_val.substring(1,11)=="delplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  5112. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  5113. if(!isNaN(parseInt(text))){
  5114. var text2 = parseInt(text);
  5115. if(text2>0){
  5116. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden"){
  5117. var jsonkeys = Object.keys(sandboxplayerids).reverse();
  5118. var packets = [];
  5119. for(var i = 0;i<text2 && i<jsonkeys.length;i++){
  5120. var packet = '42[5,'+jsonkeys[i]+',0]';
  5121. RECIEVE(packet);
  5122. packets.push(packet);
  5123. delete sandboxplayerids[jsonkeys[i]];
  5124. }
  5125. SEND("42"+JSON.stringify([4,{"type":"fakerecieve","from":username,"packet":packets,to:[-1]}]));
  5126. }
  5127. else{
  5128. displayInChat("Cannot delete players while ingame.","#DA0808","#1EBCC1");
  5129. }
  5130.  
  5131. }
  5132. }
  5133. return "";
  5134. }
  5135. else if (chat_val.substring(1,6)=="copy " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  5136. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  5137. var keys = Object.keys(playerids);
  5138. var keys2 = Object.keys(sandboxplayerids);
  5139. var copiedperson = -1;
  5140. for(var i = 0;i<keys.length;i++){
  5141. if(playerids[keys[i]].userName==text){
  5142. copiedperson = keys[i];
  5143. }
  5144. }
  5145. if(copiedperson==-1){
  5146. displayInChat(playerids[copiedperson].userName + " was not found in this room.","#DA0808","#1EBCC1");
  5147. return "";
  5148. }
  5149. if(keys2.includes(copiedperson.toString())){
  5150. displayInChat("Bots cannot copy a bot.","#DA0808","#1EBCC1");
  5151. return "";
  5152. }
  5153. displayInChat("All bots will now copy "+playerids[copiedperson].userName+".","#DA0808","#1EBCC1");
  5154. displayInChat("To reset copy, type '/copy'.","#DA0808","#1EBCC1");
  5155. sandboxcopyme = copiedperson;
  5156.  
  5157. return "";
  5158. }
  5159. else if (chat_val.substring(1,5)=="copy"){
  5160. sandboxcopyme = -1;
  5161. displayInChat("Copy is now off.","#DA0808","#1EBCC1");
  5162. return "";
  5163. }
  5164. }
  5165. }
  5166. return chat_val;
  5167. };
  5168.  
  5169. scope.flag_manage = function(t){
  5170. var text = t;
  5171. if(reverse_flag == true){
  5172. text = text.split("").reverse().join("")
  5173. }
  5174. if(rcaps_flag == true){
  5175. text = text.split('');
  5176. for(var i = 0; i<text.length;i++){
  5177. if(Math.floor(Math.random()*2)){
  5178. text[i] = text[i].toUpperCase();
  5179. }
  5180. else{
  5181. text[i] = text[i].toLowerCase();
  5182. }
  5183. }
  5184. text = text.join('');
  5185. }
  5186. if(space_flag == true){
  5187. text = text.split('').join(' ')
  5188. }
  5189. if(number_flag == true){
  5190. text = text.replace(/[t|T][Oo]+/g,"2");
  5191. text = text.replace(/[f|F][o|O][r|R]/g,"4");
  5192. text = text.replace(/[a|A][t|T][e|E]/g,"8");
  5193. text = text.replace(/[e|E]/g,"3");
  5194. text = text.replace(/[a|A]/g,"4");
  5195. text = text.replace(/[o|O]/g,"0");
  5196. text = text.replace(/[s|S]/g,"5");
  5197. text = text.replace(/[i|I|l|L]/g,"1");
  5198. }
  5199. return text;
  5200. };
  5201. Gdocument.getElementById("newbonklobby_chat_input").onkeydown = function(e){
  5202. if(e.keyCode==13){
  5203.  
  5204. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  5205.  
  5206. if (chat_val!="" && chat_val[0]=="/"){
  5207.  
  5208. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  5209. chat2(commandhandle(chat_val));
  5210. }
  5211. else{
  5212. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  5213. chat2(flag_manage(chat_val));
  5214. }
  5215.  
  5216. }
  5217. };
  5218. Gdocument.getElementById("ingamechatinputtext").onkeydown = function(e){
  5219. if(e.keyCode==13){
  5220.  
  5221. var chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  5222.  
  5223. if (chat_val!="" && chat_val[0]=="/"){
  5224.  
  5225. Gdocument.getElementById("ingamechatinputtext").value = "";
  5226. chat2(commandhandle(chat_val));
  5227. }
  5228. else{
  5229. Gdocument.getElementById("ingamechatinputtext").value = "";
  5230. chat2(flag_manage(chat_val));
  5231. }
  5232. }
  5233. };
  5234. scope.Last_message = "";
  5235. scope.Laster_message = "";
  5236. scope.new_message = false;
  5237. scope.changed_chat = false;
  5238. scope.injectedBonkCommandsScript = setInterval(timeout123,60);
  5239.  
  5240. scope.hotkeys = function(e){
  5241. var keycode = e.code;
  5242. if(e.altKey && !e.shiftKey && !e.ctrlKey && !e.metaKey){
  5243. if(keycode == "Period"){
  5244. if(Gdocument.getElementById("ingamechatcontent").style["max-height"]!="0px"){
  5245. chatheight+=5;
  5246. if(chatheight>600){chatheight = 600;}
  5247. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  5248. Gdocument.getElementById("ingamechatcontent").style["height"]=chatheight.toString()+"px";
  5249. Gdocument.getElementById("ingamechatbox").style["height"]="100%";
  5250. }
  5251. e.preventDefault();
  5252. }
  5253. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  5254. if(keycode == "KeyG"){
  5255. var addto = 0;
  5256. for(var i = 0;i<parentDraw.children.length;i++){
  5257. if(parentDraw.children[i].constructor.name == "e"){
  5258. addto = parentDraw.children[i];
  5259. break;
  5260. }
  5261. }
  5262. var canv = 0;
  5263. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  5264. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  5265. canv = Gdocument.getElementById("gamerenderer").children[i];
  5266. break;
  5267. }
  5268. }
  5269. var width = parseInt(canv.style["width"]);
  5270. var height = parseInt(canv.style["height"]);
  5271. if(addto){
  5272. zoom *= 1.1;
  5273. }
  5274. addto.scale.x = zoom;
  5275. addto.scale.y = zoom;
  5276. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  5277. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  5278. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  5279. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  5280. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999 && !FollowCam){
  5281. pixiCircle.visible = false;
  5282. }
  5283. else{
  5284. pixiCircle.visible = true;
  5285. }
  5286. e.preventDefault();
  5287. }
  5288. if(keycode == "KeyH"){
  5289. var addto = 0;
  5290. for(var i = 0;i<parentDraw.children.length;i++){
  5291. if(parentDraw.children[i].constructor.name == "e"){
  5292. addto = parentDraw.children[i];
  5293. break;
  5294. }
  5295. }
  5296. var canv = 0;
  5297. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  5298. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  5299. canv = Gdocument.getElementById("gamerenderer").children[i];
  5300. break;
  5301. }
  5302. }
  5303. var width = parseInt(canv.style["width"]);
  5304. var height = parseInt(canv.style["height"]);
  5305. if(addto){
  5306. zoom = 1;
  5307. }
  5308. addto.scale.x = zoom;
  5309. addto.scale.y = zoom;
  5310. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  5311. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  5312. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  5313. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  5314. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999 && !FollowCam){
  5315. pixiCircle.visible = false;
  5316. }
  5317. else{
  5318. pixiCircle.visible = true;
  5319. }
  5320. e.preventDefault();
  5321. }
  5322. if(keycode == "KeyJ"){
  5323. var addto = 0;
  5324. for(var i = 0;i<parentDraw.children.length;i++){
  5325. if(parentDraw.children[i].constructor.name == "e"){
  5326. addto = parentDraw.children[i];
  5327. break;
  5328. }
  5329. }
  5330. var canv = 0;
  5331. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  5332. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  5333. canv = Gdocument.getElementById("gamerenderer").children[i];
  5334. break;
  5335. }
  5336. }
  5337. var width = parseInt(canv.style["width"]);
  5338. var height = parseInt(canv.style["height"]);
  5339. if(addto){
  5340. zoom /= 1.1;
  5341. }
  5342. addto.scale.x = zoom;
  5343. addto.scale.y = zoom;
  5344. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  5345. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  5346. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  5347. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  5348. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999 && !FollowCam){
  5349. pixiCircle.visible = false;
  5350. }
  5351. else{
  5352. pixiCircle.visible = true;
  5353. }
  5354. e.preventDefault();
  5355. }
  5356. }
  5357. if(keycode == "Comma"){
  5358. if(Gdocument.getElementById("ingamechatcontent").style["max-height"]!="0px"){
  5359. chatheight-=5;
  5360. if(chatheight<100){chatheight = 100;}
  5361. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  5362. Gdocument.getElementById("ingamechatcontent").style["height"]=chatheight.toString()+"px";
  5363. Gdocument.getElementById("ingamechatbox").style["height"]="100%";
  5364. }
  5365. e.preventDefault();
  5366. }
  5367. }
  5368. if(e.repeat){return;}
  5369. if(e.altKey && !e.shiftKey && !e.ctrlKey && !e.metaKey){
  5370. if(ishost){
  5371. if(keycode == "KeyE"){
  5372. if(Gdocument.getElementById("newbonklobby").style["display"] == "block"){
  5373. Gdocument.getElementById("newbonklobby_editorbutton").click();
  5374. }
  5375. else if(Gdocument.getElementById("mapeditorcontainer").style["display"] == "block"){
  5376. Gdocument.getElementById("mapeditor_close").click();
  5377. }
  5378. e.preventDefault();
  5379.  
  5380. }
  5381. else if(keycode == "KeyT"){
  5382. Gdocument.getElementById("newbonklobby_teamsbutton").click();
  5383. e.preventDefault();
  5384. }
  5385. else if(keycode == "KeyM"){
  5386. Gdocument.getElementById("newbonklobby_modebutton").click();
  5387. e.preventDefault();
  5388. }
  5389. else if(keycode == "KeyK"){
  5390. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  5391. Gdocument.getElementById("pretty_top_exit").click();
  5392. }
  5393. e.preventDefault();
  5394. }
  5395. else if(keycode == "KeyS"){
  5396. if(Gdocument.getElementById("mapeditorcontainer").style["display"]!="block"){
  5397. Gdocument.getElementById("newbonklobby_editorbutton").click();
  5398. }
  5399. if(recmodebool && ishost){
  5400. var mode = Gdocument.getElementById("mapeditor_modeselect").value;
  5401. if(mode == "" && defaultmode!="d"){
  5402. mode = defaultmode;
  5403. }
  5404. if(mode != ""){
  5405. RECIEVE('42[26,"b","'+mode+'"]');
  5406. }
  5407. }
  5408. Gdocument.getElementById("mapeditor_close").click();
  5409. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  5410. roundsperqp2 = 0;
  5411. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  5412. e.preventDefault();
  5413. }
  5414. else if(keycode == "KeyD"){
  5415. roundsperqp2 = 0;
  5416. if(stopquickplay == 0){
  5417. if(shuffle){
  5418. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  5419. var available = [];
  5420. var availableindexes = [];
  5421. var notempty = false;
  5422. for(var i = 0; i<e2.length;i++){
  5423. var a = false;
  5424. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  5425. available.push(a);
  5426. if(a){
  5427. availableindexes.push(i);
  5428. notempty = true;
  5429. }
  5430. }
  5431. if(notempty){
  5432.  
  5433. if(availableindexes.length!=1){
  5434. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  5435. }
  5436. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  5437. }
  5438. }
  5439. else{
  5440. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  5441. var available = [];
  5442. var availableindexes = [];
  5443. var notempty = false;
  5444. for(var i = 0; i<e2.length;i++){
  5445. var a = false;
  5446. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  5447. available.push(a);
  5448. if(a){
  5449. availableindexes.push(i);
  5450. notempty = true;
  5451. }
  5452. }
  5453. if(notempty){
  5454. var above = [];
  5455. for(var i = 0;i<availableindexes.length;i++){
  5456. if(availableindexes[i]>quicki && !reverseqp){
  5457. above.push(availableindexes[i]);
  5458. }
  5459. else if(availableindexes[i]<quicki && reverseqp){
  5460. above.push(availableindexes[i])
  5461. }
  5462. }
  5463. if(above.length>0){
  5464. quicki = above[0];
  5465. if(reverseqp){
  5466. quicki = above[above.length-1];
  5467. }
  5468. }
  5469. else{
  5470. quicki = availableindexes[0];
  5471. if(reverseqp){
  5472. quicki = availableindexes[availableindexes.length-1];
  5473. }
  5474. }
  5475. }
  5476. }
  5477. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  5478. }
  5479. e.preventDefault();
  5480. }
  5481. else if(keycode == "KeyA"){
  5482. if(stopquickplay == 0){
  5483. roundsperqp2 = 0;
  5484. if(shuffle){
  5485. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  5486. var available = [];
  5487. var availableindexes = [];
  5488. var notempty = false;
  5489. for(var i = 0; i<e2.length;i++){
  5490. var a = false;
  5491. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  5492. available.push(a);
  5493. if(a){
  5494. availableindexes.push(i);
  5495. notempty = true;
  5496. }
  5497. }
  5498. if(notempty){
  5499.  
  5500. if(availableindexes.length!=1){
  5501. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  5502. }
  5503. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  5504. }
  5505. }
  5506. else{
  5507. var e2 = Gdocument.getElementById("maploadwindowmapscontainer").children;
  5508. var available = [];
  5509. var availableindexes = [];
  5510. var notempty = false;
  5511. for(var i = 0; i<e2.length;i++){
  5512. var a = false;
  5513. [...e2[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  5514. available.push(a);
  5515. if(a){
  5516. availableindexes.push(i);
  5517. notempty = true;
  5518. }
  5519. }
  5520. if(notempty){
  5521. var above = [];
  5522. for(var i = 0;i<availableindexes.length;i++){
  5523. if(availableindexes[i]<quicki && !reverseqp){
  5524. above.push(availableindexes[i]);
  5525. }
  5526. else if(availableindexes[i]>quicki && reverseqp){
  5527. above.push(availableindexes[i])
  5528. }
  5529. }
  5530. if(above.length>0){
  5531. quicki = above[above.length-1];
  5532. if(reverseqp){
  5533. quicki = above[0];
  5534. }
  5535. }
  5536. else{
  5537. quicki = availableindexes[availableindexes.length-1];
  5538. if(reverseqp){
  5539. quicki = availableindexes[0];
  5540. }
  5541. }
  5542. }
  5543. }
  5544. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  5545. }
  5546. e.preventDefault();
  5547. }
  5548. else if(keycode == "KeyQ"){
  5549. if(stopquickplay == 1){
  5550. stopquickplay = 0;
  5551. quicki = 0;
  5552. qppaused = false;
  5553. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  5554. }
  5555. else{
  5556. stopquickplay = 1;
  5557. quicki = 0;
  5558. qppaused = false;
  5559. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  5560. }
  5561. e.preventDefault();
  5562. }
  5563. else if(keycode == "KeyP" && stopquickplay==0){
  5564. if(qppaused == true){
  5565. qppaused = false;
  5566. displayInChat("Unpaused quickplay.","#DA0808","#1EBCC1");
  5567. }
  5568. else{
  5569. qppaused = true;
  5570. displayInChat("Paused quickplay.","#DA0808","#1EBCC1");
  5571. }
  5572. e.preventDefault();
  5573. }
  5574. else if(keycode == "KeyR"){
  5575. if(recmodebool == true){
  5576. recmodebool = false;
  5577. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  5578.  
  5579. }
  5580. else{
  5581. recmodebool = true;
  5582. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  5583.  
  5584. }
  5585. }
  5586. else if(keycode == "KeyF"){
  5587. if(freejoin == false){
  5588. freejoin = true;
  5589. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  5590.  
  5591. }
  5592. else{
  5593. freejoin = false;
  5594. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  5595. }
  5596. e.preventDefault();
  5597. }
  5598. }
  5599. else{
  5600. if(keycode == "KeyE"){
  5601. e.preventDefault();
  5602. }
  5603. else if(keycode == "KeyT"){
  5604. e.preventDefault();
  5605. }
  5606. else if(keycode == "KeyM"){
  5607. e.preventDefault();
  5608. }
  5609. else if(keycode == "KeyK"){
  5610. e.preventDefault();
  5611. }
  5612. else if(keycode == "KeyS"){
  5613. e.preventDefault();
  5614. }
  5615. else if(keycode == "KeyD"){
  5616. e.preventDefault();
  5617. }
  5618. else if(keycode == "KeyA"){
  5619. e.preventDefault();
  5620. }
  5621. else if(keycode == "KeyQ"){
  5622. e.preventDefault();
  5623. }
  5624. else if(keycode == "KeyP"){
  5625. e.preventDefault();
  5626. }
  5627. else if(keycode == "KeyF"){
  5628. e.preventDefault();
  5629. }
  5630. else if(keycode == "KeyR"){
  5631. e.preventDefault();
  5632. }
  5633.  
  5634. }
  5635. if(keycode == "KeyL"){
  5636. lobby();
  5637. e.preventDefault();
  5638. }
  5639. if(keycode == "KeyC"){
  5640. if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  5641. if(Gdocument.getElementById("ingamechatcontent").style["max-height"]=="0px"){
  5642. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  5643. }
  5644. else{
  5645. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  5646. }
  5647. }
  5648. e.preventDefault();
  5649. }
  5650. if(keycode == "KeyI"){
  5651. if(Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"] == "none"){
  5652. debuggeropen = true;
  5653. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="block";
  5654. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="none";
  5655. Gdocument.getElementById("ingamechatinputtext").style["display"] = "none";
  5656. }
  5657. else{
  5658. debuggeropen = false;
  5659. Gdocument.getElementById("BonkCommandsDebuggerContainer").style["display"]="none";
  5660. Gdocument.getElementById("newbonklobby_chat_input").style["display"]="";
  5661. Gdocument.getElementById("ingamechatinputtext").style["display"] = "";
  5662. }
  5663. e.preventDefault();
  5664. }
  5665. if(keycode == "KeyB"){
  5666. var element = Gdocument.getElementById("ingamewinner_scores");
  5667. element.style["visibility"] = "visible";
  5668. if(element.style["opacity"]<1){
  5669. element.style["opacity"] = 1;
  5670. }
  5671. else{
  5672. element.style["opacity"] = 0;
  5673. }
  5674. e.preventDefault();
  5675. }
  5676. if(keycode == "KeyY"){
  5677. Gdocument.getElementById("pretty_top_settings").click();
  5678. Gdocument.getElementById("settings_close").click();
  5679. if(Gdocument.getElementById("settings_graphicsquality").value==1){
  5680. displayInChat("You must have medium or high quality enabled to use this feature.","#DA0808","#1EBCC1");
  5681. return "";
  5682. }
  5683.  
  5684.  
  5685. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  5686. var addto = {"children":[]};
  5687. for(var i = 0;i<parentDraw.children.length;i++){
  5688. if(parentDraw.children[i].constructor.name == "e"){
  5689. addto = parentDraw.children[i];
  5690. break;
  5691. }
  5692. }
  5693. var addto2 = {"children":[]};
  5694. for(var i = 0;i<addto.children.length;i++){
  5695. if(addto.children[i].constructor.name == "e"){
  5696. addto2 = addto.children[i];
  5697. break;
  5698. }
  5699. }
  5700. var checkxray = addto2.children[0];
  5701. var addto3 = addto2.children[0].children;
  5702. if(addto3.length==1){
  5703. checkxray = checkxray.children[0];
  5704. addto3 = addto3[0].children;
  5705. }
  5706. var xrayon = false;
  5707. if(checkxray.xrayon){
  5708. checkxray.xrayon = false;
  5709. xrayon = false;
  5710. }
  5711. else{
  5712. checkxray.xrayon = true;
  5713. xrayon = true;
  5714. }
  5715. if(xrayon){
  5716. displayInChat("Xray is now on.","#DA0808","#1EBCC1");
  5717. for(var i = 0;i<addto3.length;i++){
  5718. if(addto3[i].children.length>0){
  5719. for(var i3 = 0;i3<addto3[i].children.length;i3++){
  5720. addto3[i].children[i3].visible = false;
  5721. if(addto3[i].children[i3].children.length>0){
  5722. addto3[i].children[i3].visible = true;
  5723. }
  5724. }
  5725. }
  5726. }
  5727.  
  5728. }
  5729. else{
  5730. displayInChat("Xray is now off.","#DA0808","#1EBCC1");
  5731. for(var i = 0;i<addto3.length;i++){
  5732. for(var i2 = 0;i2<addto3[i].children.length;i2++){
  5733. addto3[i].children[i2].visible = true;
  5734. }
  5735. }
  5736. }
  5737. }
  5738. e.preventDefault();
  5739. }
  5740. if(keycode == "KeyN"){
  5741. if(FollowCam == true){
  5742. displayInChat("Follow Camera is now off.","#DA0808","#1EBCC1");
  5743. FollowCam = false;
  5744. if(parentDraw && Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  5745. var addto = {"children":[]};
  5746. for(var i = 0;i<parentDraw.children.length;i++){
  5747. if(parentDraw.children[i].constructor.name == "e"){
  5748. addto = parentDraw.children[i];
  5749. break;
  5750. }
  5751. }
  5752. var canv = 0;
  5753. for(var i = 0;i<Gdocument.getElementById("gamerenderer").children.length;i++){
  5754. if(Gdocument.getElementById("gamerenderer").children[i].constructor.name == "HTMLCanvasElement"){
  5755. canv = Gdocument.getElementById("gamerenderer").children[i];
  5756. break;
  5757. }
  5758. }
  5759. var width = parseInt(canv.style["width"]);
  5760. var height = parseInt(canv.style["height"]);
  5761. parentDraw.x = -addto.scale.x * parseInt(width)/2 + parseInt(width)/2;
  5762. parentDraw.y = -addto.scale.y * parseInt(height)/2 + parseInt(height)/2;
  5763. parentDraw.children[0].x = parseInt(width)/2*addto.scale.x-parseInt(width)/2;
  5764. parentDraw.children[0].y = parseInt(height)/2*addto.scale.y-parseInt(height)/2;
  5765. if(addto.scale.x>=0.99999 && addto.scale.y>=0.99999){
  5766. pixiCircle.visible = false;
  5767. }
  5768. else{
  5769. pixiCircle.visible = true;
  5770. }
  5771. }
  5772. }
  5773. else{
  5774. displayInChat("Follow Camera is now on.","#DA0808","#1EBCC1");
  5775. FollowCam = true;
  5776. }
  5777. e.preventDefault();
  5778. }
  5779. if(keycode == "KeyV"){
  5780. if(autocam == true){
  5781. displayInChat("Auto Cam is now off.","#DA0808","#1EBCC1");
  5782. autocam = false
  5783. }
  5784. else{
  5785. displayInChat("Auto Cam is now on.","#DA0808","#1EBCC1");
  5786. autocam = true;
  5787. }
  5788. e.preventDefault();
  5789. }
  5790. if(keycode == "KeyO"){
  5791. if(heavybot == true){
  5792. displayInChat("Heavy bot is now off.","#DA0808","#1EBCC1");
  5793. heavybot = false;
  5794. }
  5795. else{
  5796. displayInChat("Heavy bot is now on.","#DA0808","#1EBCC1");
  5797. heavybot = true;
  5798. getplayerkeys();
  5799. }
  5800. e.preventDefault();
  5801. }
  5802. if(keycode == "KeyU"){
  5803. if(aimbot == true){
  5804. displayInChat("Aimbot is now off.","#DA0808","#1EBCC1");
  5805. aimbot = false;
  5806. }
  5807. else{
  5808. displayInChat("Aimbot is now on.","#DA0808","#1EBCC1");
  5809. aimbot = true;
  5810. getplayerkeys();
  5811. }
  5812. e.preventDefault();
  5813. }
  5814. }
  5815. if(!e.altKey && !e.shiftKey && !e.ctrlKey && !e.metaKey){
  5816. if(keycode == "Slash" && !(Gdocument.getElementById("gmeditor")?.style["transform"] == "scale(1)")){
  5817. 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"]==""){
  5818. Gdocument.getElementById("newbonklobby_chat_input").value = "/";
  5819. if(Gdocument.getElementById("newbonklobby_chat_input").style["pointer-events"] == "none"){
  5820. fire("keydown",{keyCode:13});
  5821. }
  5822. else{
  5823. Gdocument.getElementById("newbonklobby_chat_input").focus();
  5824. }
  5825. e.preventDefault();
  5826.  
  5827. }
  5828. else if(Gdocument.getElementById("ingamechatinputtext").style["visibility"]=="visible" && Gdocument.getElementById("ingamechatinputtext").style["display"]=="" && Gdocument.getElementById("mapeditorcontainer").style["display"]!="block" && Gdocument.getElementById("ingamechatinputtext").value == ""){
  5829. Gdocument.getElementById("ingamechatinputtext").value = "/";
  5830. if(!Gdocument.getElementById("ingamechatinputtext").classList.value.includes("ingamechatinputtextbg")){
  5831. fire("keydown",{keyCode:13});
  5832. }
  5833. else{
  5834. Gdocument.getElementById("ingamechatinputtext").focus();
  5835. }
  5836. e.preventDefault();
  5837.  
  5838. }
  5839. }
  5840. }
  5841. };
  5842.  
  5843. Gdocument.onkeydown = hotkeys;
  5844.  
  5845. Gwindow.addEventListener('resize',function(e){
  5846. debuggermenu.style["width"] = Gdocument.getElementById("bonkiocontainer").style["width"];
  5847. debuggermenu.style["height"] = Gdocument.getElementById("bonkiocontainer").style["height"];
  5848. scope.width = parseInt(Gdocument.getElementById("bonkiocontainer").style["width"])-20;
  5849. scope.height = parseInt(Gdocument.getElementById("bonkiocontainer").style["height"])-210;
  5850. logmenu.style["width"] = width.toString()+"px";
  5851. logmenu.style["height"] = height.toString()+"px";
  5852. logmenutopleft.style["width"] = (width/2).toString()+"px";
  5853. logmenutopright.style["width"] = (width/2).toString()+"px";
  5854. logmenutopright.style["left"] = (width/2).toString()+"px";
  5855. debuggerinput.style["width"] = width.toString()+"px";
  5856. debuggerinput.style["top"] = (height+90).toString()+"px";
  5857. debuggersendrecieve.style["top"] = (height+120).toString()+"px";
  5858. debuggerpausebutton.style["top"] = (height+150).toString()+"px";
  5859. debuggereval.style["width"] = (width-150).toString()+"px";
  5860. debuggereval.style["top"] = (height+120).toString()+"px";},true);
  5861.  
  5862.  
  5863. function timeout123() {
  5864. updateWssLog();
  5865. EVENTLOOPFUNCTION();
  5866. var now = Date.now();
  5867. var keys = Object.keys(playerids);
  5868. if(getroomslastcheck+3000<now){
  5869. getroomslastcheck = now;
  5870. if(inroom && savedrooms.length>0){
  5871. Gdocument.getElementById("roomlistrefreshbutton").click();
  5872. }
  5873. }
  5874. if(randomchat){
  5875. if(randomchat_timestamp+randomchat_randomtimestamp<now){
  5876. randomchat_timestamp = now;
  5877. randomchat_randomtimestamp = 2000+Math.random()*2000;
  5878. var randnumber = Math.floor(Math.random()*randomchatpriority[0])-randomchatlastmessage[1];
  5879. for(var i = 0;i<randomchatpriority[1].length;i++){
  5880. if(randomchatpriority[1][i][0]!=randomchatlastmessage[0] && randomchatpriority[1][i][1]!=randomchatlastmessage[1]){
  5881. randnumber-=randomchatpriority[1][i][1];
  5882. if(randnumber<=0){
  5883. chat(flag_manage(randomchatpriority[1][i][0]));
  5884. randomchatpriority[1][i][1]+=2;
  5885. randomchatpriority[0]+=2;
  5886. randomchatlastmessage = randomchatpriority[1][i];
  5887. break;
  5888. }
  5889. }
  5890. }
  5891. }
  5892. }
  5893. for(var i = 0;i<keys.length;i++){
  5894. if(autokickbantimestamp+500<now && keys[i]!=myid && !playerids[keys[i]]?.commands && autokickban>0 && playerids[keys[i]].peerID!="sandbox" && ishost && playerids[keys[i]].ratelimit.join+750<now){
  5895. SEND('42[9,{"banshortid":'+keys[i].toString()+',"kickonly":'+(autokickban == 1).toString()+'}]');
  5896. autokickbantimestamp = now;
  5897. }
  5898. if(playerids[keys[i]].playerData){
  5899. if(playerids[keys[i]].playerData2){
  5900. if(playerids[keys[i]].playerData.transform){
  5901. playerids[keys[i]].playerData2.alive = true;
  5902. if(playerids[keys[i]].playerData2.timeStamp == 0){
  5903. playerids[keys[i]].playerData2.px = playerids[keys[i]].playerData.transform.position.x;
  5904. playerids[keys[i]].playerData2.py = playerids[keys[i]].playerData.transform.position.y;
  5905. playerids[keys[i]].playerData2.timeStamp = now;
  5906. }
  5907. else{
  5908. playerids[keys[i]].playerData2.xvel = (playerids[keys[i]].playerData2.px - playerids[keys[i]].playerData.transform.position.x)/(playerids[keys[i]].playerData2.timeStamp-now);
  5909. playerids[keys[i]].playerData2.yvel = (playerids[keys[i]].playerData2.py - playerids[keys[i]].playerData.transform.position.y)/(playerids[keys[i]].playerData2.timeStamp-now);
  5910. playerids[keys[i]].playerData2.px = playerids[keys[i]].playerData.transform.position.x;
  5911. playerids[keys[i]].playerData2.py = playerids[keys[i]].playerData.transform.position.y;
  5912. playerids[keys[i]].playerData2.timeStamp = now;
  5913. }
  5914. if(playerids[keys[i]].playerData2.timeStamp2 == 0){
  5915. playerids[keys[i]].playerData2.pvx = playerids[keys[i]].playerData2.xvel;
  5916. playerids[keys[i]].playerData2.pvy = playerids[keys[i]].playerData2.yvel;
  5917. playerids[keys[i]].playerData2.timeStamp2 = now;
  5918. }
  5919. else{
  5920. playerids[keys[i]].playerData2.xacc = (playerids[keys[i]].playerData2.pvx - playerids[keys[i]].playerData2.xvel)/((playerids[keys[i]].playerData2.timeStamp2-now));
  5921. playerids[keys[i]].playerData2.yacc = (playerids[keys[i]].playerData2.pvy - playerids[keys[i]].playerData2.yvel)/((playerids[keys[i]].playerData2.timeStamp2-now));
  5922. playerids[keys[i]].playerData2.pvx = playerids[keys[i]].playerData2.xvel;
  5923. playerids[keys[i]].playerData2.pvy = playerids[keys[i]].playerData2.yvel;
  5924. playerids[keys[i]].playerData2.timeStamp2 = now;
  5925. }
  5926. }
  5927. else{
  5928. if(playerids[keys[i]].playerData2.alive){
  5929.  
  5930. }
  5931. playerids[keys[i]].playerData2.alive = false;
  5932. }
  5933. }
  5934. else{
  5935. playerids[keys[i]].playerData2 = {alive:true,radius:12,timeStamp:0,timeStamp2:0,px:0,py:0,pvx:0,pvy:0,xacc:0,yacc:0,xvel:0,yvel:0,balance:0};
  5936. }
  5937. }
  5938. }
  5939. for(var i = 0;i<keys.length;i++){
  5940. if(!playerids[keys[i]].playerData2){
  5941. playerids[keys[i]].playerData2 = {alive:true,radius:12,timeStamp:0,timeStamp2:0,px:0,py:0,pvx:0,pvy:0,xacc:0,yacc:0,xvel:0,yvel:0,balance:0};
  5942. }
  5943. }
  5944. if(Gdocument.getElementById("redefineControls_table").children[0].children.length<=1 && keys.length>0){
  5945. Gdocument.getElementById("pretty_top_settings").click();
  5946. Gdocument.getElementById("settings_close").click();
  5947. }
  5948. if(pollactive[0] && pollactive[2]<now && ishost){
  5949. playerids[myid].ratelimit.poll = Date.now();
  5950. SEND("42"+JSON.stringify([4,{"type":"poll end","from":username}]));
  5951. var count = [0,0,0,0];
  5952. var keys = Object.keys(playerids);
  5953. for(var i = 0;i<keys.length;i++){
  5954. if(playerids[keys[i]].vote.poll!=-1 && playerids[keys[i]].vote.poll<pollactive[3].length-1){
  5955. count[playerids[keys[i]].vote.poll]++;
  5956. }
  5957. playerids[keys[i]].vote.poll = -1;
  5958. }
  5959. displayInChat("The poll ended due to time.","#DA0808","#1EBCC1");
  5960. for(var i = 0;i<count.length;i++){
  5961. if(count[i]>1){
  5962. displayInChat(count[i].toString()+" people voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  5963. }
  5964. if(count[i]==1){
  5965. displayInChat(count[i].toString()+" person voted for option "+letters[i]+".","#DA0808","#1EBCC1");
  5966. }
  5967. }
  5968. displayInChat("The poll was:","#DA0808","#1EBCC1");
  5969. for(var i = 0;i<pollactive[3].length;i++){
  5970. displayInChat(letters[i]+") "+pollactive[3][i],"#DA0808","#1EBCC1");
  5971. }
  5972. pollactive = [false,0,0,[]];
  5973. }
  5974. if(!ishost && sandboxcopyme!=-1){
  5975. sandboxcopyme = -1;
  5976. }
  5977. if(afkkill>0 && ishost){
  5978. var keys = Object.keys(playerids);
  5979. currentFrame = Math.floor((now - gameStartTimeStamp)/1000*30);
  5980. for(var i = 0; i<keys.length;i++){
  5981. if(typeof(playerids[keys[i]].lastmove)=="undefined"){
  5982. playerids[keys[i]].lastmove = now;
  5983. }
  5984. else{
  5985. if(playerids[keys[i]].playerData2?.alive && now-playerids[keys[i]].lastmove>=afkkill*1000 && now-gameStartTimeStamp>=afkkill*1000 && !killedids.includes(keys[i])){
  5986. killedids.push(keys[i]);
  5987. SEND('42[25,{"a":{"playersLeft":['+keys[i]+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  5988. RECIEVE('42[31,{"a":{"playersLeft":['+keys[i]+'],"playersJoined":[]},"f":'+currentFrame.toString()+'}]');
  5989. break;
  5990. }
  5991. }
  5992. }
  5993. }
  5994. if(ishost && Gdocument.getElementById("maploadtypedropdowntitle").textContent == "MAP REQUESTS"){
  5995. clearmaprequests.style["display"] = "block";
  5996. refreshmaprequests.style["display"] = "block";
  5997. }
  5998. else{
  5999. clearmaprequests.style["display"] = "none";
  6000. refreshmaprequests.style["display"] = "none";
  6001. }
  6002. if(Gdocument.getElementById("gamerenderer").style["visibility"]=="hidden"){
  6003. Gdocument.getElementById("ingamewinner_scores").style["visibility"] = "unset";
  6004. Gdocument.getElementById("ingamechatcontent").style["max-height"]=chatheight.toString()+"px";
  6005. }
  6006. if(Gdocument.getElementById("maploadwindowmapscontainer").children.length>0 && maponclick == 0){
  6007. maponclick = Gdocument.getElementById("maploadwindowmapscontainer").children[0].onclick;
  6008. }
  6009. if((Gdocument.getElementById("sm_connectingContainer").style["visibility"] == "hidden" || Gdocument.getElementById("sm_connectingContainer").style["visibility"] == "") && (Gdocument.getElementById("roomlistcreatewindowcontainer").style["visibility"] == "hidden" || Gdocument.getElementById("roomlistcreatewindowcontainer").style["visibility"] == "")){
  6010. var chatbox = Gdocument.getElementById("newbonklobby_chat_content");
  6011. while (chatbox.firstChild) {
  6012. chatbox.removeChild(chatbox.firstChild);
  6013. }
  6014. chatbox = Gdocument.getElementById("ingamechatcontent");
  6015. while (chatbox.firstChild) {
  6016. chatbox.removeChild(chatbox.firstChild);
  6017. }
  6018. rcaps_flag = false;
  6019. space_flag = false;
  6020. number_flag = false;
  6021. reverse_flag = false;
  6022. echo_list = [];
  6023. scroll = false;
  6024. FollowCam = false;
  6025. autocam = false;
  6026. aimbot = false;
  6027. recievedinitdata = false;
  6028. zoom = 1;
  6029. zoom2 = 1;
  6030. newzoom = 1;
  6031. newzoom2 = 1;
  6032. FFA = true;
  6033. mode = "b";
  6034. ghostroomwss = -1;
  6035. heavybot = false;
  6036. stopquickplay = 1;
  6037. roundsperqp = 1;
  6038. roundsperqp2 = 0;
  6039. staystill = false;
  6040. staystillpos = [0,0];
  6041. recording = false;
  6042. recordingid = -1;
  6043. reverseqp = false;
  6044. jointeam = -1;
  6045. currentroomaddress = -1;
  6046. checkboxhidden = false;
  6047. freejoin = false;
  6048. shuffle = false;
  6049. defaultmode = "";
  6050. recmodebool = false;
  6051. recteams = false;
  6052. autorecord = false;
  6053. pollactive = [false,0,0,[]];
  6054. pollactive2 = [false,0,[]];
  6055. afkkill = -1;
  6056. nextafter = 0;
  6057. jointext = "";
  6058. ishost = false;
  6059. parentDraw = 0;
  6060. sandboxplayerids = {};
  6061. sandboxcopyme = -1;
  6062. wintext = "";
  6063. sandboxon = false;
  6064. sandboxid = 200;
  6065. disabledkeys = [];
  6066. myid = -1;
  6067. randomchat = false;
  6068. savedroombutton.className = "brownButton brownButton_classic buttonShadow brownButtonDisabled";
  6069. randomchatpriority = [0,[]];
  6070. randomchatlastmessage = ["",0];
  6071. autokickbantimestamp = 0;
  6072. autokickban = 0;
  6073. inroom = false;
  6074. causelag = false;
  6075. causelag2 = 0;
  6076. jukeboxplayerURL = "";
  6077. jukeboxplayer.src = "";
  6078. jukeboxplayervolume = 20;
  6079. if(!bonkwss){
  6080. playerids = {};
  6081. }
  6082.  
  6083. qppaused = false;
  6084. nextafterbuffer = -1;
  6085. hostid = -1;
  6086. if(chatlog[chatlog.length-1]!="ROOM END"){
  6087. chatlog.push("ROOM END");
  6088. }
  6089. }
  6090. else{
  6091. if(chatlog[chatlog.length-1]=="ROOM END"){
  6092. chatlog.push("ROOM START");
  6093. }
  6094. }
  6095.  
  6096. if(Gdocument.getElementById("newbonklobby").style["display"]=="block"){
  6097. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="hidden";
  6098. }
  6099. else{
  6100. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="visible";
  6101.  
  6102. }
  6103. if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 0){
  6104. ishost = true;
  6105. }
  6106. else{
  6107. ishost = actuallyhost;
  6108. }
  6109.  
  6110. if(Gdocument.getElementById("pretty_top_name")!=null){
  6111. username = Gdocument.getElementById("pretty_top_name").textContent;
  6112. if(myid!=-1){
  6113. username = playerids[myid].userName;
  6114. }
  6115. }
  6116. try{
  6117. Last_message = lastmessage()
  6118. } catch{
  6119. Last_message = "";
  6120. }
  6121. if (Laster_message != Last_message){
  6122. Laster_message = Last_message;
  6123. if(changed_chat==false){
  6124. new_message = true;
  6125. }
  6126. else{
  6127. changed_chat = false;
  6128. }
  6129. }
  6130. if(new_message){
  6131. chatlog.push(Last_message);
  6132. var lm = "";
  6133. try{
  6134. lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  6135. if(typeof(lm[0].parentElement.style["parsed"]) == 'undefined'){
  6136. if (lm[0].className == "newbonklobby_chat_msg_colorbox"){
  6137. lm[2].innerHTML = urlify(lm[2].innerHTML);
  6138. Laster_message = lastmessage();
  6139. lm[0].parentElement.style["parsed"] = true;
  6140. }
  6141. if (lm[0].className == "newbonklobby_chat_status"){
  6142. lm[0].innerHTML = urlify(lm[0].innerHTML);
  6143. Laster_message = lastmessage();
  6144. lm[0].parentElement.style["parsed"] = true;
  6145. }
  6146. }
  6147. }
  6148. catch{
  6149. lm = "";
  6150. }
  6151.  
  6152. if(Last_message.indexOf("@"+username)!=-1 && npermissions == 1){
  6153. if(Notification.requestPermission()){
  6154. var n = new Notification(Last_message);
  6155. }
  6156. }
  6157.  
  6158. try{
  6159. lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  6160. if(typeof(lm[0].parentElement.style["parsed"])=='undefined'){
  6161. if(lm[0].className == "ingamechatname"){
  6162. lm[1].innerHTML = urlify(lm[1].innerHTML);
  6163. Laster_message = lastmessage();
  6164. lm[0].parentElement.style["parsed"] = true;
  6165. }
  6166. if(lm[0].className == ""){
  6167. lm[0].innerHTML = urlify(lm[0].innerHTML);
  6168. Laster_message = lastmessage();
  6169. lm[0].parentElement.style["parsed"] = true;
  6170. }
  6171. }
  6172. }
  6173. catch{
  6174. lm = "";
  6175. }
  6176. if(text2speech){
  6177. if(!sayer.speaking){
  6178. if(Last_message.includes(": ")){
  6179. speech.text = Last_message.substring(0,Last_message.indexOf(":")).toLowerCase();
  6180. speech.rate = 2.25;
  6181. sayer.speak(speech);
  6182. speech.text = Last_message.substring(Last_message.indexOf(": ")+3).toLowerCase();
  6183. speech.rate = 1.25;
  6184. sayer.speak(speech);
  6185. }
  6186. else{
  6187. speech.text = Last_message.toLowerCase();
  6188. sayer.speak(speech);
  6189. }
  6190. }
  6191. }
  6192. }
  6193. if (ishost==true && new_message){
  6194. for(i=0;i<banned.length;i++){
  6195. if(Last_message.startsWith("* "+banned[i]+" has joined the game")){
  6196. chat2("/kick '"+banned[i]+"'");
  6197. }
  6198. }
  6199. }
  6200. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden" && ishost){
  6201. roundsperqp2 = 0;
  6202. }
  6203. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && ishost){
  6204. if(Gdocument.getElementById("ingamewinner").style["parsed"] != true){
  6205. if(stopquickplay!=1){
  6206. roundsperqp2++;
  6207. }
  6208. if(autorecord){
  6209. Gdocument.getElementById("pretty_top_replay").click();
  6210. }
  6211. }
  6212. if(Gdocument.getElementById("ingamewinner").style["parsed"] != true && wintext!="" && Gdocument.getElementById("ingamewinner_bottom").textContent!="DRAW"){
  6213. chat(flag_manage(wintext.replaceAll("username",Gdocument.getElementById("ingamewinner_top").textContent)));
  6214. }
  6215. Gdocument.getElementById("ingamewinner").style["parsed"] = true;
  6216. }
  6217. else{
  6218. Gdocument.getElementById("ingamewinner").style["parsed"] = false;
  6219. }
  6220. if(ishost && stopquickplay == 0){
  6221. if(checkboxhidden){
  6222. checkboxhidden = false;
  6223. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  6224. for(var i = 0; i<classes.length;i++){
  6225. classes[i].style["display"] = "block";
  6226. classes[i].className = "quickplaycheckbox quickplaychecked";
  6227. }
  6228. Gdocument.getElementById('clearallcheckboxes').style["display"] = "block";
  6229.  
  6230. }
  6231. if(nextafter>0 && gameStartTimeStamp+nextafter*1000<=now && Gdocument.getElementById("gamerenderer").style["visibility"] != "hidden" && dontswitch == false && Gdocument.getElementById("ingamewinner").style["visibility"]!="inherit" && !qppaused){
  6232. roundsperqp2 = 0;
  6233. if(shuffle){
  6234. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  6235. var available = [];
  6236. var availableindexes = [];
  6237. var notempty = false;
  6238. for(var i = 0; i<e.length;i++){
  6239. var a = false;
  6240. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  6241. available.push(a);
  6242. if(a){
  6243. availableindexes.push(i);
  6244. notempty = true;
  6245. }
  6246. }
  6247. if(notempty){
  6248. if(availableindexes.length!=1){
  6249. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  6250. }
  6251. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  6252. }
  6253. }
  6254. else{
  6255. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  6256. var available = [];
  6257. var availableindexes = [];
  6258. var notempty = false;
  6259. for(var i = 0; i<e.length;i++){
  6260. var a = false;
  6261. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  6262. available.push(a);
  6263. if(a){
  6264. availableindexes.push(i);
  6265. notempty = true;
  6266. }
  6267. }
  6268. if(notempty){
  6269. var above = [];
  6270. for(var i = 0;i<availableindexes.length;i++){
  6271. if(availableindexes[i]>quicki && !reverseqp){
  6272. above.push(availableindexes[i]);
  6273. }
  6274. else if(availableindexes[i]<quicki && reverseqp){
  6275. above.push(availableindexes[i]);
  6276. }
  6277. }
  6278. if(above.length>0){
  6279. quicki = above[0];
  6280. if(reverseqp){
  6281. above[above.length-1];
  6282. }
  6283. }
  6284. else{
  6285. quicki = availableindexes[0];
  6286. if(reverseqp){
  6287. quicki = availableindexes[availableindexes.length-1];
  6288. }
  6289. }
  6290. }
  6291. }
  6292. startedinqp = true;
  6293. dontswitch = true;
  6294. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  6295. }
  6296. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && dontswitch == false && !document.hidden && !qppaused){
  6297. if(roundsperqp2>=roundsperqp){
  6298. if(shuffle){
  6299. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  6300. var available = [];
  6301. var availableindexes = [];
  6302. var notempty = false;
  6303. for(var i = 0; i<e.length;i++){
  6304. var a = false;
  6305. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  6306. available.push(a);
  6307. if(a){
  6308. availableindexes.push(i);
  6309. notempty = true;
  6310. }
  6311. }
  6312. if(notempty){
  6313.  
  6314. if(availableindexes.length!=1){
  6315. availableindexes.splice(availableindexes.indexOf(quicki%Gdocument.getElementById("maploadwindowmapscontainer").children.length),1);
  6316. }
  6317. quicki = availableindexes[Math.floor(Math.random()*availableindexes.length)];
  6318. }
  6319. }
  6320. else{
  6321. var e = Gdocument.getElementById("maploadwindowmapscontainer").children;
  6322. var available = [];
  6323. var availableindexes = [];
  6324. var notempty = false;
  6325. for(var i = 0; i<e.length;i++){
  6326. var a = false;
  6327. [...e[i].children].forEach(function(e1){if(e1.className=="quickplaycheckbox quickplaychecked"){a = e1.checked}});
  6328. available.push(a);
  6329. if(a){
  6330. availableindexes.push(i);
  6331. notempty = true;
  6332. }
  6333. }
  6334. if(notempty){
  6335. var above = [];
  6336. for(var i = 0;i<availableindexes.length;i++){
  6337. if(availableindexes[i]>quicki && !reverseqp){
  6338. above.push(availableindexes[i]);
  6339. }
  6340. else if(availableindexes[i]<quicki && reverseqp){
  6341. above.push(availableindexes[i])
  6342. }
  6343. }
  6344. if(above.length>0){
  6345. quicki = above[0];
  6346. if(reverseqp){
  6347. quicki = above[above.length-1];
  6348. }
  6349. }
  6350. else{
  6351. quicki = availableindexes[0];
  6352. if(reverseqp){
  6353. quicki = availableindexes[availableindexes.length-1];
  6354. }
  6355.  
  6356. }
  6357. }
  6358. }
  6359. }
  6360. transitioning = true;
  6361. startedinqp = true;
  6362. map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  6363. dontswitch = true;
  6364. setTimeout(function(){Gdocument.getElementById("ingamewinner").style["visibility"]="hidden"; dontswitch = false;},timedelay);
  6365. }
  6366. }
  6367. else{
  6368. if(!checkboxhidden){
  6369. checkboxhidden = true;
  6370. var classes = Gdocument.getElementsByClassName("quickplaycheckbox");
  6371. for(var i = 0; i<classes.length;i++){
  6372. classes[i].style["display"] = "none";
  6373. classes[i].className = "quickplaycheckbox quickplayunchecked";
  6374. }
  6375. Gdocument.getElementById('clearallcheckboxes').style["display"] = "none";
  6376. }
  6377. }
  6378. new_message = false;
  6379. };
  6380. });

QingJ © 2025

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