Bonk Commands

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

当前为 2022-10-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk Commands
  3. // @namespace https://greasyfork.org/en/scripts/451341-bonk-commands
  4. // @version 3.4
  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.  
  13. function BonkCommandsScriptInjector(f){
  14. if(document.readyState == "complete"){f();}
  15. else{document.addEventListener('readystatechange',function(){setTimeout(f,1500);});}
  16. }
  17.  
  18. BonkCommandsScriptInjector(function(){
  19. var scope = window;
  20.  
  21. scope.Gwindow = document.getElementById("maingameframe").contentWindow;
  22. scope.Gdocument = document.getElementById("maingameframe").contentDocument;
  23.  
  24. scope.link2pastebin = "https://pastebin.com/2b8XqqYu";
  25. scope.link2greasyfork = "https://greasyfork.org/en/scripts/451341-bonk-commands";
  26.  
  27. if(typeof(scope.injectedBonkCommandsScript)=='undefined'){
  28. scope.injectedBonkCommandsScript = true;
  29. }
  30. else{
  31. for (var i = 0; i < 100000; i++){
  32. clearInterval(i);
  33. }
  34. }
  35.  
  36. if(typeof(scope.originalSend)=='undefined'){scope.originalSend = Gwindow.WebSocket.prototype.send;}
  37. if(typeof(scope.bonkwss)=='undefined'){scope.bonkwss = 0;}
  38. if(typeof(scope.sandboxon)=='undefined'){scope.sandboxon = false;}
  39. if(typeof(scope.sandboxid)=='undefined'){scope.sandboxid = 1;}
  40. if(typeof(scope.playerids)=='undefined'){scope.playerids = {};}
  41. if(typeof(scope.sandboxplayerids)=='undefined'){scope.sandboxplayerids = {};}
  42. if(typeof(scope.originalLobbyChat)=='undefined'){scope.originalLobbyChat = document.getElementById("newbonklobby_chat_content").appendChild;}
  43. if(typeof(scope.originalIngameChat)=='undefined'){scope.originalIngameChat = document.getElementById("ingamechatcontent").appendChild;}
  44.  
  45. function sandboxonclick(){
  46. Gdocument.getElementById("roomlistcreatewindowmaxplayers").value = 1;
  47. Gdocument.getElementById("roomlistcreatewindowunlistedcheckbox").checked = true;
  48. Gdocument.getElementById("roomlistcreatecreatebutton").click();
  49. sandboxon = true;
  50. }
  51. if(Gdocument.getElementById("classic_mid_sandbox")==null){
  52. Gdocument.getElementById("roomlistrefreshbutton").click();
  53. scope.sandboxbutton = Gdocument.createElement("div");
  54. sandboxbutton.id = "classic_mid_sandbox";
  55. sandboxbutton.classList.value = "brownButton brownButton_classic classic_mid_buttons";
  56. sandboxbutton.textContent = "SANDBOX";
  57. sandboxbutton.addEventListener("click",sandboxonclick);
  58. Gdocument.getElementById("classic_mid").insertBefore(sandboxbutton,Gdocument.getElementById("classic_mid_news"));
  59.  
  60. }
  61.  
  62. Gwindow.WebSocket.prototype.send = function(args) {
  63. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=")){
  64. bonkwss = this;
  65. if(args.startsWith('42[26,')){
  66. if(sandboxon){
  67. var jsonargs = JSON.parse(args.substring(2))[1];
  68. if(typeof(sandboxplayerids[jsonargs["targetID"]])!='undefined'){
  69. RECIEVE('42[18,'+jsonargs["targetID"]+','+jsonargs["targetTeam"]+']');
  70.  
  71. }
  72. }
  73. }
  74. if(args.startsWith('42[4,')){
  75. var jsonargs = JSON.parse(args.substring(2));
  76. if(sandboxcopyme && typeof(jsonargs[1]["type"])=="undefined"){
  77. var jsonkeys = Object.keys(sandboxplayerids);
  78. for(var i = 0; i<jsonkeys.length;i++){
  79. RECIEVE('42[7,'+jsonkeys[i].toString()+','+JSON.stringify(jsonargs[1])+']');
  80. }
  81. }
  82. args = "42"+JSON.stringify(jsonargs);
  83. }
  84.  
  85. if(args.startsWith('42[5,')){
  86. var jsonargs = JSON.parse(args.substring(2));
  87.  
  88. if(stopquickplay!=1){
  89. jsonargs[1]["gs"]["wl"] = 999;
  90. }
  91. if(recmodebool){
  92. Gdocument.getElementById("newbonklobby_editorbutton").click();
  93. var newmode = Gdocument.getElementById("mapeditor_modeselect").value;
  94. Gdocument.getElementById("mapeditor_close").click();
  95.  
  96. if(newmode!=""){
  97. RECIEVE('42[26,"b","'+newmode+'"]');
  98. }
  99. else{
  100. if(defaultmode != ""){
  101. RECIEVE('42[26,"b","'+defaultmode+'"]');
  102. }
  103. }
  104. }
  105. args = "42"+JSON.stringify(jsonargs);
  106. }
  107.  
  108. }
  109. if(this.url.includes(".bonk.io/socket.io/?EIO=3&transport=websocket&sid=") && !this.injected){
  110. this.injected = true;
  111.  
  112. var originalRecieve = this.onmessage;
  113. this.onmessage = function(args){
  114. if(args.data.startsWith('42[1,')){
  115. var jsonargs = JSON.parse(args.data.substring(2));
  116. SEND('42[1,{"id":'+jsonargs[2]+'}]');
  117. }
  118. if(args.data.startsWith('42[7,')){
  119. var jsonargs = JSON.parse(args.data.substring(2))[2];
  120. if(typeof(jsonargs["type"]) != "undefined"){
  121. if(jsonargs["type"]=="private chat" && (jsonargs["to"] == username)){
  122. if(typeof(jsonargs["message"])=="object" && typeof(jsonargs["password"]) == "object"){
  123. var password = CRYPT_MESSAGE(private_key,jsonargs["password"]);
  124. var decodedtext = jsonargs["message"].slice(0,400);
  125. var encodedtext = "";
  126. for(var i=0;i<decodedtext.length;i++){
  127. if(password[i%password.length]<1000){
  128. encodedtext+=String.fromCharCode(password[i%password.length]^decodedtext[i]);
  129. }
  130. }
  131. displayInChat("> "+jsonargs["from"]+": "+encodedtext,"#DA0808","#1EBCC1");
  132. }
  133. }
  134. if(jsonargs["type"]=="request public key" && jsonargs["to"] == username){
  135. SEND("42"+JSON.stringify([4,{"type":"public key","from":username,"public key":public_key}]));
  136. }
  137. if(jsonargs["type"]=="public key" && jsonargs["from"] == private_chat && request_public_key_time_stamp+1500>Date.now()){
  138. private_chat_public_key = [private_chat,jsonargs["public key"]];
  139. displayInChat("Private chatting with "+private_chat+".","#DA0808","#1EBCC1");
  140.  
  141. }
  142.  
  143. }
  144. }
  145.  
  146. if(args.data.startsWith('42[4,')){
  147. var jsonargs = JSON.parse(args.data.substring(2));
  148. playerids[jsonargs[1]] = jsonargs[3];
  149.  
  150. }
  151. if(args.data.startsWith('42[5,')){
  152. var jsonargs = JSON.parse(args.data.substring(2));
  153. if(typeof(playerids[jsonargs[1]])!='undefined'){
  154. delete playerids[jsonargs[1]];
  155. }
  156. }
  157. return originalRecieve.call(this,args);
  158. };
  159.  
  160. var originalClose = this.onclose;
  161. this.onclose = function () {
  162. window.bonkwss = 0;
  163. return originalClose.call(this);
  164. }
  165.  
  166. }
  167.  
  168. return originalSend.call(this,args);
  169. };
  170.  
  171. scope.SEND = function(args){
  172. if(bonkwss!=0){
  173. bonkwss.send(args);
  174. }
  175. };
  176. scope.RECIEVE = function(args){
  177. if(bonkwss!=0){
  178. bonkwss.onmessage({data:args});
  179. }
  180. };
  181. Gdocument.getElementById("ingamechatcontent").style["pointer-events"]="all";
  182. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  183. Gdocument.getElementById("ingamechatcontent").style["height"]="128px";
  184. Gdocument.getElementById("ingamechatbox").style["height"]="250px";
  185.  
  186. document.getElementById('adboxverticalCurse').style["display"] = "none";
  187. document.getElementById('adboxverticalleftCurse').style["display"] = "none";
  188.  
  189. scope.GENERATE_PRIME_NUMBER = function(mini = 0,maxi = 0,choices = []){
  190. if(choices.length == 0){
  191. for(var i = mini;i<maxi+1;i++){
  192. choices.push(i);
  193. }
  194. }
  195. firstTry = choices[Math.floor(Math.random()*choices.length)];
  196. for(var i = 2; i<Math.floor(Math.sqrt(firstTry)+1);i++){
  197. if(i!=firstTry){
  198. if(firstTry%i == 0){
  199. choices.splice(choices.indexOf(firstTry),1);
  200. if(choices.length == 0){
  201. return 0;
  202. }
  203. return GENERATE_PRIME_NUMBER(mini,maxi,choices);
  204. }
  205. }
  206. }
  207. return firstTry;
  208. };
  209.  
  210. scope.GENERATE_KEYS = function(){
  211. interval = [];
  212. for(var i = 100;i<301;i++){
  213. interval.push(i);
  214. }
  215. random_prime = [GENERATE_PRIME_NUMBER(0,0,choices = interval),0];
  216. interval.splice(interval.indexOf(random_prime[0]),1);
  217. random_prime[1] = GENERATE_PRIME_NUMBER(0,0,choices = interval);
  218.  
  219. n = random_prime[0]*random_prime[1];
  220. n2 = (random_prime[0]-1)*(random_prime[1]-1);
  221.  
  222. e = GENERATE_PRIME_NUMBER(2,n2-1);
  223. d = 0;
  224. redo = true;
  225. for(var i = 0;i<1000000;i++){
  226. if((e*i-1)%n2 == 0 && i!=e){
  227. d = i;
  228. redo = false;
  229. break;
  230. }
  231. }
  232. if(redo){
  233. return GENERATE_KEYS();
  234. }
  235. else{
  236. return [[n,e],[n,d]];
  237. }
  238.  
  239. };
  240. scope.CRYPT_NUMBER = function(key, data){
  241.  
  242. result = 1;
  243.  
  244. for(var i = 0;i<key[1];i++){
  245. result*=data;
  246. result = result%key[0];
  247. }
  248. return result%key[0];
  249.  
  250. };
  251.  
  252. scope.CRYPT_MESSAGE = function(key,data){
  253. var resulttext = [];
  254. for(var i = 0;i<data.length;i++){
  255. resulttext.push(CRYPT_NUMBER(key,data[i]));
  256. }
  257. return resulttext;
  258.  
  259. };
  260.  
  261. scope.dontswitch = false;
  262. scope.username = 0;
  263. scope.timedelay = 1400;
  264. scope.ishost = false;
  265. scope.quicki=0;
  266. scope.defaultmode = "d";
  267. scope.recmodebool = false;
  268. scope.freejoin = false;
  269. scope.stopquickplay = 1;
  270. scope.canceled = false;
  271. scope.banned = [];
  272. scope.transitioning = false;
  273. scope.echo_list = [];
  274. scope.message = "";
  275. scope.mode = "";
  276. scope.private_chat = "";
  277. scope.private_chat_public_key = ["",[0,0]];
  278. scope.users = [];
  279. scope.scroll = false;
  280. scope.elem = Gdocument.getElementById("maploadwindowmapscontainer");
  281. scope.npermissions = 1;
  282. scope.space_flag = false;
  283. scope.rcaps_flag = false;
  284. scope.number_flag = false;
  285. scope.private_chat_keys = GENERATE_KEYS();
  286. scope.private_key = private_chat_keys[0];
  287. scope.public_key = private_chat_keys[1];
  288. scope.request_public_key_time_stamp = 0;
  289. scope.sandboxcopyme = false;
  290. scope.help = ["All the commands are:","/help","/?","/advhelp [command]","/space","/rcaps","/number","/echo [username]","/remove [username]","/clearecho","/chatw [username]","/msg [text]","/requestfake \"[mapname]\", \"[mapauthor]\"","/eval [code]","/lobby","/team [letter]","/scroll","/hidechat","/showchat","/notify","/stopnotify","Host commands are:","/startqp","/stopqp","/next","/previous","/freejoin","/start","/balanceA [number]","/rounds [number]","/ban [username]","Sandbox commands are:","/addplayer [number]","/delplayer [number]","/copyme"];
  291.  
  292. scope.adv_help = {"help":"Shows all command names.",
  293. "?":"Shows all command names.",
  294. "advhelp":"Shows a command in detail.",
  295. "space":"Toggles space. When space is on, whatever you type will be spaced apart.",
  296. "rcaps":"Toggles rcaps. When rcaps is on, each letter will randomly get capitalized.",
  297. "number":"Toggles number. When number is on, 'a' becomes 4, 'e' becomes 3, 's' becomes 5, 'o' becomes 0, 'l' and 'i' become 1.",
  298. "echo":"Echoes a username. It copies the username's chat messages.",
  299. "remove":"Removes username from echo list. You will not echo that username anymore.",
  300. "clearecho":"Clears echo list. You will not echo anyone anymore.",
  301. "chatw":"It private chats with username. Type /msg to message that username.",
  302. "msg":"Messages with what username you are chatting with. Type /chatw to chat with a username.",
  303. "requestfake":"Requests a fake map. The host will not see the request.",
  304. "eval":"Evaluates code. Only use this if you are experienced in javascript.",
  305. "lobby":"Makes lobby visible when you are ingame. Type /lobby again to close lobby.",
  306. "team":"Joins a specific team. 'r' = red, 'b' = blue, 'g' = green, 'y' = yellow, and 's' = spectate.",
  307. "scroll":"Toggles a scrollbar in ingame chat.",
  308. "hidechat":"Hides ingame chat. Type /showchat to show it again.",
  309. "showchat":"Shows ingame chat. /hidechat hides the chat.",
  310. "notify":"You will be notified if a person types @MYUSERNAME",
  311. "stopnotify":"You will not be notified if a person types @MYUSERNAME",
  312. "startqp":"Starts cycling maps in your map menu.",
  313. "stopqp":"Stops cycling maps in your map menu.",
  314. "next":"Skips the map. Usable only with /startqp.",
  315. "previous":"Goes to previous map. Usable only with /startqp.",
  316. "freejoin":"Toggles freejoin. If freejoin is on, starts the game instantly if there are 1 or less players currently playing",
  317. "start":"Starts game instantly.",
  318. "balanceA":"Balances everyone with balance number.",
  319. "rounds":"Sets rounds to win.",
  320. "ban":"Bans username from lobby. If they rejoin, it automatically bans.",
  321. "addplayer":"In sandbox, it adds players.",
  322. "delplayer":"In sandbox, it deletes players.",
  323. "copyme":"In sandbox, it makes each player copy your movements."};
  324.  
  325. elem.onclick=function(e){
  326. if(stopquickplay==0 && ishost == true && e.isTrusted == true){
  327. quicki = (Array.from(e.target.parentElement.parentNode.children).indexOf(e.target.parentNode)-1)%(Gdocument.getElementById("maploadwindowmapscontainer").children.length);
  328. }
  329. };
  330. scope.urlify = function(text) {
  331. return text.replace(/(?:https?:\/\/)?(?:[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)(?:\.[A-Za-z0-9-ßàÁâãóôþüúðæåïçèõöÿýòäœêëìíøùîûñé]+)+(?:\/(?:[A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]|%[0-9a-fA-F]{2})*)?(?:\?(?:[^=]+=[^&](?:&[^=]+=[^&])*)?)?/g, function(url) {
  332. return '<a href="' + url + '" target="_blank" style = "color:orange">' + url + '</a>';
  333. })
  334. };
  335.  
  336. scope.fire = function(type,options,d = Gdocument){
  337. var event=new CustomEvent(type);
  338. for(var p in options){
  339. event[p]=options[p];
  340. }
  341. d.dispatchEvent(event);
  342. };
  343.  
  344. scope.chat = function(message){
  345. mess = Gdocument.getElementById("newbonklobby_chat_input").value;
  346. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  347. Gdocument.getElementById("newbonklobby_chat_input").value = message;
  348. Gdocument.getElementById("ingamechatinputtext").value = message;
  349. fire("keydown",{keyCode:13});
  350. fire("keydown",{keyCode:13});
  351. Gdocument.getElementById("newbonklobby_chat_input").value = mess;
  352. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  353. };
  354. scope.displayInChat = function(message, LobbyColor, InGameColor, options) {
  355. options = options ?? {};
  356. LobbyColor = LobbyColor ?? "#8800FF";
  357. InGameColor = InGameColor ?? "#AA88FF";
  358. let A = Gdocument.createElement("div");
  359. let B = Gdocument.createElement("span");
  360. B.className = "newbonklobby_chat_status";
  361. B.style.color = LobbyColor;
  362. A.appendChild(B);
  363. B.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  364. let C = Gdocument.createElement("div");
  365. let D = Gdocument.createElement("span");
  366. D.style.color = InGameColor;
  367. C.appendChild(D);
  368. D.innerHTML = (options.sanitize ?? true) ? message.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;') : message;
  369. let a = false;
  370. if(Gdocument.getElementById("newbonklobby_chat_content").scrollHeight - Gdocument.getElementById("newbonklobby_chat_content").scrollTop > Gdocument.getElementById("newbonklobby_chat_content").clientHeight - 1) {
  371. a = true;
  372. }
  373. Gdocument.getElementById("newbonklobby_chat_content").appendChild(A);
  374. Gdocument.getElementById("ingamechatcontent").appendChild(C);
  375. if (a) { Gdocument.getElementById("newbonklobby_chat_content").scrollTop = Number.MAX_SAFE_INTEGER;};
  376. Gdocument.getElementById("ingamechatcontent").scrollTop = Number.MAX_SAFE_INTEGER;
  377. };
  378.  
  379. scope.lobby = function(){
  380. if (Gdocument.getElementById("newbonklobby").style["display"]=="none"){
  381.  
  382. Gdocument.getElementById("newbonklobby_editorbutton").click();
  383. Gdocument.getElementById("mapeditor_close").click();
  384. if(Gdocument.getElementsByClassName("newbonklobby_playerentry").length>0){
  385. Gdocument.getElementById("newbonklobby").style["z-index"]=1;
  386. Gdocument.getElementById("maploadwindowcontainer").style["z-index"]=1;
  387. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=1;
  388. Gdocument.getElementById("pretty_top").style["z-index"]=2;
  389. Gdocument.getElementById("settingsContainer").style["z-index"]=2;
  390. Gdocument.getElementById("leaveconfirmwindow").style["z-index"]=2;
  391. Gdocument.getElementById("hostleaveconfirmwindow").style["z-index"]=2;
  392. }
  393. else{
  394. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  395. Gdocument.getElementById("newbonklobby").style["display"]="none";
  396. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  397. }
  398.  
  399. }
  400. else if(Gdocument.getElementById("gamerenderer").style["visibility"]!="hidden"){
  401. Gdocument.getElementById("newbonklobby").style["opacity"]=0;
  402. Gdocument.getElementById("newbonklobby").style["display"]="none";
  403. Gdocument.getElementById("mapeditorcontainer").style["z-index"]=0;
  404. }
  405. };
  406.  
  407. scope.lastmessage = function(){
  408. if(Gdocument.getElementById("newbonklobby_chat_content").children.length!=0){
  409. var lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  410. var lm2 = "";
  411. for(var i = 0; i<lm.length;i++){
  412. lm2+=" "+lm[i].textContent.trim();
  413. }
  414. lm2 = lm2.trim();
  415. if(lm2.startsWith("*")){
  416. return lm2;
  417. }
  418. }
  419. if(Gdocument.getElementById("ingamechatcontent").children.length!=0){
  420. var lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  421. var lm2 = "";
  422. for(var i = 0; i<lm.length;i++){
  423. lm2+=" "+lm[i].textContent.trim();
  424. }
  425. return lm2.trim();
  426. }
  427. return "";
  428.  
  429. };
  430. scope.map = function(e){
  431. if(e<0){
  432. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  433. quicki = 0;
  434. return;
  435. }
  436. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  437. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  438. return;
  439. }
  440.  
  441. setTimeout(function(){if(!canceled){
  442. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  443. Gdocument.getElementById("newbonklobby_editorbutton").click();
  444. Gdocument.getElementById("mapeditor_close").click();
  445. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  446. Gdocument.getElementById("mapeditor_midbox_testbutton").click();}
  447. canceled = false;
  448. transitioning = false;
  449. },timedelay);
  450.  
  451. };
  452.  
  453. scope.gotonextmap = function(e){
  454. if(e<0){
  455. displayInChat("There is no previous map.","#DA0808","#1EBCC1");
  456. quicki = 0;
  457. return;
  458. }
  459. if(Gdocument.getElementById("maploadwindowmapscontainer").children[e] == undefined){
  460. displayInChat("Click the maps button.","#DA0808","#1EBCC1");
  461. return;
  462. }
  463. Gdocument.getElementById("maploadwindowmapscontainer").children[e].click();
  464. Gdocument.getElementById("newbonklobby_editorbutton").click();
  465. Gdocument.getElementById("mapeditor_close").click();
  466. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  467. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  468. Gdocument.getElementById("newbonklobby").style["visibility"] = "visible";
  469. };
  470. scope.commandhandle = function(chat_val){
  471. if (chat_val.substring(1,6)=="echo " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  472. if (chat_val.substring(6).replace(/^\s+|\s+$/g, '')==username){
  473. displayInChat("You cannot echo yourself.","#DA0808","#1EBCC1");
  474. return "";
  475. }
  476. else if (echo_list.indexOf(chat_val.substring(6).replace(/^\s+|\s+$/g, ''))===-1) {
  477.  
  478. echo_list.push(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  479. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is being echoed.","#DA0808","#1EBCC1");
  480. return "";
  481. }
  482. else{
  483. displayInChat(chat_val.substring(6).replace(/^\s+|\s+$/g, '') + " is already being echoed.","#DA0808","#1EBCC1");
  484. return "";
  485. }
  486. }
  487. else if (chat_val.substring(1,8)=="remove " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  488. if (echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, ''))!==-1){
  489. echo_list.splice(echo_list.indexOf(chat_val.substring(7).replace(/^\s+|\s+$/g, '')),1);
  490. displayInChat(chat_val.substring(7).replace(/^\s+|\s+$/g, '')+" is not being echoed.","#DA0808","#1EBCC1");
  491. return "";
  492. }
  493. else{
  494. displayInChat("You cannot remove someone that you didn't echo.","#DA0808","#1EBCC1");
  495. return "";
  496. }
  497.  
  498. }
  499. else if (chat_val.substring(1,10)=="clearecho"){
  500. echo_list = [];
  501. displayInChat("Cleared the echo list.","#DA0808","#1EBCC1");
  502. return "";
  503. }
  504. else if (chat_val.substring(1,6)=="space"){
  505. if(space_flag == true){
  506. displayInChat("Space is now off.","#DA0808","#1EBCC1");
  507. space_flag = false;
  508. }
  509. else{
  510. displayInChat("Space is now on.","#DA0808","#1EBCC1");
  511. space_flag = true;
  512. }
  513. return "";
  514. }
  515. else if (chat_val.substring(1,6)=="rcaps"){
  516. if(rcaps_flag == true){
  517. displayInChat("Rcaps is now off.","#DA0808","#1EBCC1");
  518. rcaps_flag = false;
  519. }
  520. else{
  521. displayInChat("Rcaps is now on.","#DA0808","#1EBCC1");
  522. rcaps_flag = true;
  523. }
  524.  
  525. return "";
  526. }
  527. else if (chat_val.substring(1,7)=="number"){
  528. if(number_flag == true){
  529. displayInChat("Number is now off.","#DA0808","#1EBCC1");
  530. number_flag = false;
  531. }
  532. else{
  533. displayInChat("Number is now on.","#DA0808","#1EBCC1");
  534. number_flag = true;
  535. }
  536.  
  537. return "";
  538. }
  539. else if (chat_val.substring(1,12)=="requestfake" && chat_val.replace(/^\s+|\s+$/g, '').length>=13){
  540. var mess = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  541. var result;
  542. var key;
  543. try{
  544. result = JSON.parse("{"+mess.replaceAll(",",":")+"}");
  545. if(Object.keys(result).length!=1){
  546. throw "";
  547. }
  548. else{
  549. key = Object.keys(result)[0];
  550. }
  551. SEND('42'+JSON.stringify([27,{"m":"","mapname":key.replaceAll(":",","),"mapauthor":result[key].replaceAll(":",",")}]));
  552. return "";
  553. }
  554. catch{
  555. displayInChat('Format: /requestfake "mapname", "mapauthor"',"#DA0808","#1EBCC1");
  556. return "";
  557. }
  558. return "";
  559.  
  560. }
  561. else if (chat_val.substring(1,6)=="eval " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  562. var ev = "";
  563. try{
  564. ev = eval(chat_val.substring(6).replace(/^\s+|\s+$/g, ''));
  565. }
  566. catch(e){
  567. displayInChat(e.message,"#DA0808","#1EBCC1");
  568. }
  569. try{
  570. displayInChat(ev.toString(),"#DA0808","#1EBCC1");
  571. }
  572. catch{
  573. }
  574.  
  575. return "";
  576.  
  577. }
  578.  
  579. else if (chat_val.substring(1,9)=="hidechat"){
  580. Gdocument.getElementById("ingamechatcontent").style["max-height"]="0px";
  581. return "";
  582. }
  583. else if (chat_val.substring(1,9)=="showchat"){
  584. Gdocument.getElementById("ingamechatcontent").style["max-height"]="250px";
  585. return "";
  586. }
  587.  
  588. else if (chat_val.substring(1,7)=="scroll"){
  589. if(scroll==false){
  590. scroll = true;
  591. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="scroll";
  592. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  593. }
  594. else if(scroll==true){
  595. scroll = false;
  596. Gdocument.getElementById("ingamechatcontent").style["overflow-y"]="hidden";
  597. Gdocument.getElementById("ingamechatcontent").style["overflow-x"]="hidden";
  598. }
  599.  
  600. return "";
  601. }
  602.  
  603. else if (chat_val.substring(1,7)=="chatw "){
  604. var text = chat_val.substring(7).replace(/^\s+|\s+$/g, '');
  605.  
  606. if(username == text){
  607. displayInChat("You cannot private chat with yourself.","#DA0808","#1EBCC1");
  608. return "";
  609. }
  610. private_chat = text;
  611.  
  612. SEND("42"+JSON.stringify([4,{"type":"request public key","from":username,"to":private_chat}]));
  613. request_public_key_time_stamp = Date.now();
  614. 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);
  615. return "";
  616. }
  617.  
  618. else if (chat_val.substring(1,5)=="msg " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  619. if(private_chat_public_key[1][0] != 0 && private_chat_public_key[1][1] != 0 && private_chat_public_key[0] == private_chat){
  620. var text = chat_val.substring(5).replace(/^\s+|\s+$/g, '');
  621. var password = [];
  622. for(var i = 0;i<5;i++){
  623. password.push(Math.floor(Math.random()*100+50));
  624. }
  625. var text2 = [];
  626. for(var i = 0;i<text.slice(0,400).length ;i++){
  627. text2.push(password[i%password.length]^text.slice(0,400).charCodeAt(i));
  628. }
  629. SEND("42"+JSON.stringify([4,{"type":"private chat","from":username,"to":private_chat,"message":text2,"password":CRYPT_MESSAGE(private_chat_public_key[1],password)}]));
  630. displayInChat("> "+username+": "+text,"#DA0808","#1EBCC1");
  631.  
  632. }
  633. return "";
  634. }
  635. else if (chat_val.substring(1,6)=="lobby"){
  636. lobby();
  637. return "";
  638. }
  639. else if (chat_val.substring(1,6)=="team " && chat_val.replace(/^\s+|\s+$/g, '').length>=7){
  640. var text = chat_val.substring(6).replace(/^\s+|\s+$/g, '');
  641. if(text == "r"){Gdocument.getElementById("newbonklobby_redbutton").click();}
  642. else if(text == "g"){Gdocument.getElementById("newbonklobby_greenbutton").click();}
  643. else if(text == "y"){Gdocument.getElementById("newbonklobby_yellowbutton").click();}
  644. else if(text == "b"){Gdocument.getElementById("newbonklobby_bluebutton").click();}
  645. else if(text == "s"){Gdocument.getElementById("newbonklobby_specbutton").click();}
  646. else if(text == "f"){Gdocument.getElementById("newbonklobby_ffabutton").click();}
  647. return "";
  648. }
  649. else if (chat_val.substring(1,7)=="notify"){
  650.  
  651. npermissions = 1;
  652. return "";
  653. }
  654. else if (chat_val.substring(1,11)=="stopnotify"){
  655.  
  656. npermissions = 0;
  657. return "";
  658. }
  659. else if (chat_val.substring(1,5)=="help" || chat_val.substring(1,2)=="?"){
  660. for(var i = 0;i<help.length;i++){
  661. displayInChat(help[i],"#DA0808","#1EBCC1");
  662.  
  663. }
  664. return "";
  665. }
  666. else if (chat_val.substring(1,9)=="advhelp " && chat_val.replace(/^\s+|\s+$/g, '').length>=10){
  667. var text = chat_val.substring(9).replace(/^\s+|\s+$/g, '');
  668. if(typeof(adv_help[text])!='undefined'){
  669. displayInChat(adv_help[text],"#DA0808","#1EBCC1");
  670. }
  671. return "";
  672. }
  673. else if(ishost){
  674.  
  675. if (chat_val.substring(1,5)=="next" && stopquickplay == 0){
  676. quicki++;
  677. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  678. displayInChat("Switched to next map.","#DA0808","#1EBCC1");
  679. return "";
  680.  
  681. }
  682. else if (chat_val.substring(1,9)=="freejoin"){
  683. if(freejoin == false){
  684. freejoin = true;
  685. displayInChat("Freejoin is now on.","#DA0808","#1EBCC1");
  686.  
  687. }
  688. else{
  689. freejoin = false;
  690. displayInChat("Freejoin is now off.","#DA0808","#1EBCC1");
  691. }
  692.  
  693. return "";
  694.  
  695. }
  696.  
  697. else if (chat_val.substring(1,9)=="previous" && stopquickplay == 0){
  698. quicki--;
  699. gotonextmap(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  700.  
  701. displayInChat("Switched to previous map.","#DA0808","#1EBCC1");
  702. return "";
  703. }
  704. else if (chat_val.substring(1,6)=="start" && chat_val.length == 6){
  705. Gdocument.getElementById("newbonklobby_editorbutton").click();
  706. Gdocument.getElementById("mapeditor_close").click();
  707. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  708. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  709.  
  710. return "";
  711. }
  712.  
  713. else if (chat_val.substring(1,8)=="startqp" && stopquickplay == 1){
  714. stopquickplay = 0;
  715. quicki = 0;
  716. displayInChat("Enabled quickplay.","#DA0808","#1EBCC1");
  717. return "";
  718. }
  719. else if (chat_val.substring(1,7)=="stopqp" && stopquickplay == 0){
  720. stopquickplay = 1;
  721. quicki = 0;
  722. displayInChat("Disabled quickplay.","#DA0808","#1EBCC1");
  723. return "";
  724. }
  725.  
  726. else if (chat_val.substring(1,5)=="ban " && chat_val.replace(/^\s+|\s+$/g, '').length>=6){
  727. banned.push(chat_val.substring(5).replace(/^\s+|\s+$/g, ''));
  728. displayInChat("Banned "+chat_val.substring(5).replace(/^\s+|\s+$/g, '')+".","#DA0808","#1EBCC1");
  729. return "/kick '" + chat_val.substring(5).replace(/^\s+|\s+$/g, '') + "'";
  730. }
  731. else if (chat_val.substring(1,10)=="balanceA " && chat_val.replace(/^\s+|\s+$/g, '').length>=11){
  732. var text = chat_val.substring(10).replace(/^\s+|\s+$/g, '');
  733. if(!isNaN(parseInt(text))){
  734. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  735. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  736. Gdocument.getElementById("ingamechatinputtext").value = "";
  737. Gdocument.getElementById("newbonklobby_editorbutton").click();
  738. Gdocument.getElementById("mapeditor_close").click();
  739. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  740. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  741.  
  742. }
  743. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry");
  744. for(var i = 0; i<playing.length;i++){
  745. chat("/balance \""+playing[i].children[1].textContent+"\" "+text)
  746. }
  747. }
  748. return "";
  749.  
  750. }
  751. else if (chat_val.substring(1,8)=="rounds " && chat_val.replace(/^\s+|\s+$/g, '').length>=9){
  752. var text = chat_val.substring(8).replace(/^\s+|\s+$/g, '');
  753. if(!isNaN(parseInt(text))){
  754. text = parseInt(text).toString();
  755. SEND('42[21,{"w":'+text+'}]');
  756. RECIEVE('42[27,'+text+']');
  757. }
  758. return "";
  759.  
  760. }
  761. else if (chat_val.substring(1,13)=="defaultmode " && chat_val.replace(/^\s+|\s+$/g, '').length>=14){
  762. var text = chat_val.substring(13).replace(/^\s+|\s+$/g, '');
  763. if(text == "default"){
  764. defaultmode = "";
  765. displayInChat("Changed default mode to default.","#DA0808","#1EBCC1");
  766. }
  767. else if(text == "arrows"){
  768. defaultmode = "ar";
  769. displayInChat("Changed default mode to arrows.","#DA0808","#1EBCC1");
  770. }
  771. else if(text == "death arrows"){
  772. defaultmode = "ard";
  773. displayInChat("Changed default mode to death arrows.","#DA0808","#1EBCC1");
  774. }
  775. else if(text == "grapple"){
  776. defaultmode = "sp";
  777. displayInChat("Changed default mode to grapple.","#DA0808","#1EBCC1");
  778. }
  779. else if(text == "classic"){
  780. defaultmode = "b";
  781. displayInChat("Changed default mode to classic.","#DA0808","#1EBCC1");
  782.  
  783. }
  784. else{
  785. displayInChat("Default mode options:","#DA0808","#1EBCC1");
  786. displayInChat("default","#DA0808","#1EBCC1");
  787. displayInChat("classic","#DA0808","#1EBCC1");
  788. displayInChat("arrows","#DA0808","#1EBCC1");
  789. displayInChat("death arrows","#DA0808","#1EBCC1");
  790. displayInChat("grapple","#DA0808","#1EBCC1");
  791. }
  792. return "";
  793.  
  794. }
  795. else if (chat_val.substring(1,8)=="recmode"){
  796. if(recmodebool == true){
  797. recmodebool = false;
  798. displayInChat("Recmode is now off.","#DA0808","#1EBCC1");
  799.  
  800. }
  801. else{
  802. recmodebool = true;
  803. displayInChat("Recmode is now on.","#DA0808","#1EBCC1");
  804.  
  805. }
  806.  
  807. return "";
  808.  
  809. }
  810. else if(sandboxon){
  811. if (chat_val.substring(1,11)=="addplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  812. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  813. if(!isNaN(parseInt(text))){
  814. var text2 = parseInt(text);
  815. if(text2>0){
  816. for(var i = 0;i<text2;i++){
  817. RECIEVE('42[4,'+sandboxid+',"0123456789abcdef","'+sandboxid.toString()+'",true,0,1,{"layers":[],"bc":'+Math.floor(Math.random() * 16777215).toString()+'}]');
  818. sandboxplayerids[sandboxid] = sandboxid.toString();
  819. sandboxid+=1;
  820. }
  821.  
  822. }
  823. }
  824. return "";
  825.  
  826. }
  827. else if (chat_val.substring(1,11)=="delplayer " && chat_val.replace(/^\s+|\s+$/g, '').length>=12){
  828. var text = chat_val.substring(11).replace(/^\s+|\s+$/g, '');
  829. if(!isNaN(parseInt(text))){
  830. var text2 = parseInt(text);
  831. if(text2>0){
  832. if(Gdocument.getElementById("gamerenderer").style["visibility"] == "hidden"){
  833. var jsonkeys = Object.keys(sandboxplayerids).reverse();
  834. for(var i = 0;i<text2 && i<jsonkeys.length;i++){
  835. RECIEVE('42[5,'+jsonkeys[i]+',0]');
  836. delete sandboxplayerids[jsonkeys[i]];
  837. }
  838. }
  839. else{
  840. displayInChat("Cannot delete players while ingame.","#DA0808","#1EBCC1");
  841. }
  842.  
  843. }
  844. }
  845. return "";
  846. }
  847. else if (chat_val.substring(1,7)=="copyme"){
  848. if(sandboxcopyme == true){
  849. displayInChat("Copyme is now off.","#DA0808","#1EBCC1");
  850. sandboxcopyme = false;
  851. }
  852. else{
  853. displayInChat("Copyme is now on.","#DA0808","#1EBCC1");
  854. sandboxcopyme = true;
  855. }
  856.  
  857. return "";
  858. }
  859. }
  860. }
  861. return chat_val;
  862. };
  863.  
  864. scope.flag_manage = function(t){
  865. var text = t;
  866.  
  867. if(rcaps_flag == true){
  868. text = text.split('');
  869. for(var i = 0; i<text.length;i++){
  870. if(Math.floor(Math.random()*2)){
  871. text[i] = text[i].toUpperCase();
  872. }
  873. else{
  874. text[i] = text[i].toLowerCase();
  875. }
  876. }
  877. text = text.join('');
  878. }
  879. if(space_flag == true){
  880. text = text.split('').join(' ')
  881. }
  882. if(number_flag == true){
  883. text = text.replace(/[t|T][Oo]+/g,"2");
  884. text = text.replace(/[f|F][o|O][r|R]/g,"4");
  885. text = text.replace(/[a|A][t|T][e|E]/g,"8");
  886. text = text.replace(/[e|E]/g,"3");
  887. text = text.replace(/[a|A]/g,"4");
  888. text = text.replace(/[o|O]/g,"0");
  889. text = text.replace(/[s|S]/g,"5");
  890. text = text.replace(/[i|I|l|L]/g,"1");
  891. }
  892. return text;
  893. };
  894. Gdocument.getElementById("newbonklobby_chat_input").onkeydown = function(e){
  895. if(e.keyCode==13){
  896.  
  897. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  898.  
  899. if (chat_val!="" && chat_val[0]=="/"){
  900.  
  901. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  902. chat(commandhandle(chat_val));
  903. }
  904. else{
  905. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  906. chat(flag_manage(chat_val));
  907. }
  908. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  909. if (chat_val!="" && chat_val[0]=="/"){
  910.  
  911. Gdocument.getElementById("ingamechatinputtext").value = "";
  912. chat(commandhandle(chat_val));
  913. }
  914. else{
  915. Gdocument.getElementById("ingamechatinputtext").value = "";
  916. chat(flag_manage(chat_val));
  917. }
  918.  
  919. }
  920. };
  921. Gdocument.getElementById("ingamechatinputtext").onkeydown = function(e){
  922. if(e.keyCode==13){
  923.  
  924. var chat_val = Gdocument.getElementById("newbonklobby_chat_input").value;
  925. if (chat_val!="" && chat_val[0]=="/"){
  926.  
  927. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  928. chat(commandhandle(chat_val));
  929. }
  930. else{
  931. Gdocument.getElementById("newbonklobby_chat_input").value = "";
  932. chat(flag_manage(chat_val));
  933. }
  934. chat_val = Gdocument.getElementById("ingamechatinputtext").value;
  935.  
  936. if (chat_val!="" && chat_val[0]=="/"){
  937.  
  938. Gdocument.getElementById("ingamechatinputtext").value = "";
  939. chat(commandhandle(chat_val));
  940. }
  941. else{
  942. Gdocument.getElementById("ingamechatinputtext").value = "";
  943. chat(flag_manage(chat_val));
  944. }
  945. }
  946. };
  947. scope.Last_message = "";
  948. scope.Laster_message = "";
  949. scope.new_message = false;
  950. scope.changed_chat = false;
  951. scope.interval = setInterval(timeout123,100);
  952. function timeout123() {
  953.  
  954. if(Gdocument.getElementById("sm_connectingContainer").style["visibility"] == "hidden"){
  955. var chatbox = Gdocument.getElementById("newbonklobby_chat_content");
  956. while (chatbox.firstChild) {
  957. chatbox.removeChild(chatbox.firstChild);
  958. }
  959. rcaps_flag = false;
  960. space_flag = false;
  961. number_flag = false;
  962. echo_list = [];
  963. scroll = false;
  964. stopquickplay = 1;
  965. freejoin = false;
  966. defaultmode = "";
  967. recmodebool = false;
  968. playerids = {};
  969. ishost = false;
  970. sandboxplayerids = {};
  971. sandboxcopyme = false;
  972. sandboxon = false;
  973. sandboxid = 1;
  974.  
  975. }
  976. if(Gdocument.getElementById("ingametextwarning_afk").style["display"]=="table"){
  977. Gdocument.getElementById("pretty_top_settings").click();
  978. key2 = Gdocument.getElementById("redefineControls_table").children[0].children[5].children[1].innerHTML.charCodeAt(0);
  979. Gdocument.getElementById("settings_close").click();
  980.  
  981. if(key2>0){
  982. fire("keydown",{keyCode:key2},Gwindow);
  983. setTimeout(function(){fire("keyup",{keyCode:key2},Gwindow)},100);
  984. }
  985.  
  986. }
  987.  
  988. if(Gdocument.getElementById("newbonklobby").style["display"]=="block"){
  989. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="hidden";
  990. }
  991. else{
  992. Gdocument.getElementById("ingamechatinputtext").style["visibility"]="visible";
  993.  
  994. }
  995. mode = Gdocument.getElementById("newbonklobby_modetext").textContent;
  996. var userlist = Gdocument.getElementsByClassName("newbonklobby_playerentry_name");
  997. users = [];
  998. for(var i = 0;i<userlist.length;i++){
  999. users.push(userlist[i].textContent);
  1000. }
  1001. if(Gdocument.getElementsByClassName('newbonklobby_settings_button brownButton brownButton_classic buttonShadow brownButtonDisabled').length == 0){
  1002. ishost = true;
  1003. }
  1004. else{
  1005. ishost = false;
  1006. }
  1007.  
  1008. if(Gdocument.getElementById("pretty_top_name")!=null){
  1009. username = Gdocument.getElementById("pretty_top_name").textContent;
  1010. }
  1011. try{
  1012. Last_message = lastmessage()
  1013. } catch{
  1014. Last_message = "";
  1015. }
  1016. if (Laster_message != Last_message){
  1017. Laster_message = Last_message;
  1018. if(changed_chat==false){
  1019. new_message = true;
  1020. }
  1021. else{
  1022. changed_chat = false;
  1023. }
  1024. }
  1025. if(new_message){
  1026. if(freejoin && Last_message.startsWith("* ") && Last_message.endsWith(" has joined the game") && ishost){
  1027.  
  1028. var userjoined = Last_message.substring(2,Last_message.length-20);
  1029.  
  1030. if(Gdocument.getElementById("newbonklobby").style["display"] != "block"){
  1031. mess2 = Gdocument.getElementById("ingamechatinputtext").value;
  1032. Gdocument.getElementById("ingamechatinputtext").value = "";
  1033. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1034. Gdocument.getElementById("mapeditor_close").click();
  1035. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1036. Gdocument.getElementById("ingamechatinputtext").value = mess2;
  1037.  
  1038. }
  1039. var playing = Gdocument.getElementsByClassName("newbonklobby_playerentry newbonklobby_playerentry_half");
  1040. var inplaying = false;
  1041. for(var i = 0;i<playing.length;i++){
  1042. if(userjoined == playing[i].children[1].textContent){
  1043. inplaying = true;
  1044. break;
  1045. }
  1046. }
  1047.  
  1048. if(playing.length<=2 && inplaying){
  1049. Gdocument.getElementById("newbonklobby_editorbutton").click();
  1050. Gdocument.getElementById("mapeditor_close").click();
  1051. Gdocument.getElementById("newbonklobby").style["display"] = "none";
  1052. Gdocument.getElementById("mapeditor_midbox_testbutton").click();
  1053. if(transitioning == true){
  1054. canceled = true;
  1055. }
  1056. }
  1057.  
  1058. }
  1059. var lm = "";
  1060. try{
  1061. lm = Gdocument.getElementById("newbonklobby_chat_content").children[Gdocument.getElementById("newbonklobby_chat_content").children.length-1].children;
  1062. if (lm[0].className == "newbonklobby_chat_msg_colorbox"){
  1063. lm[2].innerHTML = urlify(lm[2].innerHTML);
  1064. Laster_message = lastmessage();
  1065. }
  1066. if (lm[0].className == "newbonklobby_chat_status"){
  1067. lm[0].innerHTML = urlify(lm[0].innerHTML);
  1068. Laster_message = lastmessage();
  1069. }
  1070. }
  1071. catch{
  1072. lm = "";
  1073. }
  1074.  
  1075. if(Last_message.indexOf("@"+username)!=-1 && npermissions == 1){
  1076. var n = new Notification(Last_message);
  1077. }
  1078.  
  1079. try{
  1080. lm = Gdocument.getElementById("ingamechatcontent").children[Gdocument.getElementById("ingamechatcontent").children.length-1].children;
  1081. if(lm[0].className == "ingamechatname"){
  1082. lm[1].innerHTML = urlify(lm[1].innerHTML);
  1083. Laster_message = lastmessage();
  1084. }
  1085. if(lm[0].className == ""){
  1086. lm[0].innerHTML = urlify(lm[0].innerHTML);
  1087. Laster_message = lastmessage();
  1088. }
  1089. }
  1090. catch{
  1091. lm = "";
  1092. }
  1093.  
  1094. for(i=0;i<echo_list.length;i++){
  1095. if(Last_message.substring(0,echo_list[i].length+2) == echo_list[i]+": "){
  1096. message = Last_message.substring(echo_list[i].length+2);
  1097. chat(flag_manage(message));
  1098. }
  1099. }
  1100. }
  1101. if (ishost==true && new_message){
  1102. for(i=0;i<banned.length;i++){
  1103. if(Last_message == "* "+banned[i]+" has joined the game "){
  1104. chat("/kick '"+banned[i]+"'");
  1105. }
  1106. }
  1107. }
  1108. if(ishost == true && stopquickplay == 0){
  1109.  
  1110. if(Gdocument.getElementById("ingamewinner").style["visibility"]=="inherit" && stopquickplay == 0 && dontswitch == false){
  1111. quicki++;
  1112. transitioning = true;
  1113. map(quicki%(Gdocument.getElementById("maploadwindowmapscontainer").children.length));
  1114.  
  1115. dontswitch = true;
  1116. setTimeout(function(){Gdocument.getElementById("ingamewinner").style["visibility"]="hidden"; dontswitch = false;},timedelay);
  1117.  
  1118. }
  1119. }
  1120. new_message = false;
  1121. };
  1122. });