Bonk Commands

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

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

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

QingJ © 2025

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