您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Makes hosting rooms in bonk.io better
当前为
// ==UserScript== // @name Bonk Host // @version 1.5 // @author Salama // @description Makes hosting rooms in bonk.io better // @match https://bonk.io/gameframe-release.html // @run-at document-start // @grant none // @supportURL https://discord.gg/Dj6usq7ww3 // @namespace https://greasyfork.org/users/824888 // ==/UserScript== // for use as a userscript ensure you have Excigma's code injector userscript // https://greasyfork.org/en/scripts/433861-code-injector-bonk-io let injector = (str) => { let newStr = str; let CUSTOM_COMMANDS = ` if(t7V[7][0] == "/hhelp") { j0V[69][t7V[3][644]]("/balance * -100 to 100",S9L.C1E(1870),false); j0V[69][t7V[3][644]]("/balanceall -100 to 100",S9L.C1E(1870),false); j0V[69][t7V[3][644]]("/start",S9L.C1E(1870),false); } else if(t7V[7][0] == "/start") { document.getElementById("newbonklobby_startbutton").click(); } `; let BALANCE_ALL_MESSAGE = ` if(t7V[67] == -2) { j0V[69].showStatusMessage(S9L.C1E(1875) + "Everyone" + S9L.C1E(1877) + t7V[95], S9L.C1E(1870), false); } else if(t7V[95] == 0) `; let BALANCE_SELECTION = ` j0V[23].bal[t7V[97]] = t7V[95]; j0V[94][t7V[3][646]](t7V[97], t7V[95]); if (j0V[69]) { j0V[69][t7V[3][647]](); } t7V[67]=-2; if(j0V[44][t7V[97]][t7V[3][568]][t7V[3][645]]() == t7V[6][t7V[3][645]]()) { t7V[67]=t7V[95]; break; } `; let AUTO_NO_TEAMS = ` if(typeof(this) == "object" && this.autoForcedTeams && G7p[0][2].mo != S9L.C1E(116)) { this.autoForcedTeams = false; G7p[0][2][m7p[4][114]] = false; G7p[5][m7p[4][790]](G7p[0][2][m7p[4][702]],G7p[0][2][m7p[4][118]]); G7p[1][m7p[4][663]](); G7p[5][m7p[4][828]](G7p[0][2][m7p[4][114]]); G7p[1][m7p[4][647]](); }`; let SUGGESTION_MODE_BUTTON = ` let space = document.createElement("span"); space.classList.add("newbonklobby_mapsuggest_high"); space.appendChild(document.createTextNode(" ")); let smb = document.createElement("span"); smb.classList.add("newbonklobby_mapsuggest_high"); smb.classList.add("newbonklobby_chat_link"); smb.style.color="#ff0000"; P1R[99].setButtonSounds([smb]); smb.onclick = () => { Y7p[34].onclick(); window.bonkSetMode(G7p[7][Y7p[34].suggestID].m.mo); }; `; let APPEND_SUGGESTION_MODE_BUTTON = ` if(!!P1R[43].modes[G7p[7][Y7p[34].suggestID].m.mo]) { Y7p[9].appendChild(space); smb.appendChild(document.createTextNode("[" + P1R[43].modes[G7p[7][Y7p[34].suggestID].m.mo].lobbyName + "]")); Y7p[9].appendChild(smb); } `; let modeStuff = newStr.match( new RegExp( "(var .{2,4}=\\[arguments\\];.{2,4}\\[\\d{1,2}\\]=.{2,5};).{1,300}\ \\+\\+;\ if.{5,60}=0;\\}\ (.{5,50}=.{5,50})\ \\[.{2,4}\\[\\d{1,4}\\]\\];\ (.{5,200}=true.{5,200}\\(\\);)\ \\}\\}" ) ); // 1 is var m7p = [arguments]; m7p[4] = y3uu; // 2 is G7p[0][2]["mo"] = P1R[43]["lobbyModes"] // 3 is code that updates the mode let modeVar = modeStuff[2].split("=")[0].match(/.{2,4}\[\d{1,2}\]\[\d{1,2}\]/g)[0] + `["mo"]`; let modesObject = modeStuff[2].split("=")[1].match(/.{2,4}\[\d{2,4}\]/g)[0] + `["modes"]`; window.modeDropdownCreated = false; window.createModeDropdown = () => { if (window.modeDropdownCreated) return; window.modeDropdownCreated = true; const dropdown = document.createElement("div"); dropdown.classList = "dropdown-container"; const mds = dropdown.style; mds.color = "#ffffff"; mds.position = "absolute"; mds.right = "15px"; mds.bottom = "55px"; mds.width = "116px"; mds.height = "30px"; mds.display = "flex"; mds.textAlign = "center"; mds.flexDirection = "column-reverse"; document.getElementById("newbonklobby_modebutton").remove(); title = document.createElement("div"); title.classList = "dropdown-title dropdown_classic"; title.innerText = "MODE"; title.style.fontSize = "18px"; title.id = "newbonklobby_modebutton"; title.style.position = "unset"; dropdown.appendChild(title); const options = []; let dropdownOpen = false; function toggleVisibility(e) { dropdownOpen = !dropdownOpen; for (const o of options) { o.style.visibility = dropdownOpen ? "" : "hidden"; } e.stopImmediatePropagation(); } for (const mode of Object.keys(window.bonkModesObject)) { const option = document.createElement("div"); option.classList = "dropdown-option dropdown_classic"; option.style.display = "block"; option.style.visibility = "hidden"; option.style.fontSize = "15px"; option.innerText = window.bonkModesObject[mode].lobbyName; option.onclick = (e) => { window.bonkSetMode(mode); toggleVisibility(e); }; options.push(option); dropdown.appendChild(option); } title.addEventListener("click", toggleVisibility); document.getElementById("newbonklobby_settingsbox").appendChild(dropdown); };//Remove round limit document.getElementById('newbonklobby_roundsinput').removeAttribute("maxlength"); newStr = newStr.replace(/...\[[0-9]\]\[[0-9]\]\[...\[[0-9]\]\[[0-9]?[0-9]?[0-9]\]\]=Math\[...\[[0-9]\]\[[0-9]?[0-9]?[0-9]\]\]\(Math\[...\[[0-9]\]\[[0-9]?[0-9]?[0-9]\]\]\(1,...\[[0-9]\]\[[0-9]\]\[...\[[0-9]\]\[[0-9]?[0-9]?[0-9]\]\]\),9\);/, ''); //Mode selection menu newStr = newStr.replace(modeStuff[0], `${modeStuff[0]};window.bonkModesObject=${modesObject};window.bonkSetMode=m=>{${modeStuff[1]}${modeVar}=m;${modeStuff[3]}};window.createModeDropdown();`); //Add mode mutton to map suggestion message newStr = newStr.replace('P1R[99][Y7p[2][624]]([Y7p[34]]);', 'P1R[99][Y7p[2][624]]([Y7p[34]]);' + SUGGESTION_MODE_BUTTON); //Append mode button newStr = newStr.replace('Y7p[9][Y7p[2][455]](Y7p[34]);', 'Y7p[9][Y7p[2][455]](Y7p[34]);'+APPEND_SUGGESTION_MODE_BUTTON); //Balance all newStr = newStr.replace('t7V[6][t7V[3][645]]()', 't7V[6][t7V[3][645]]() || t7V[6] === "*" || t7V[7][0] == "/balanceall"'); newStr = newStr.replace('t7V[7][0] == S9L.W1E(1868)', 't7V[7][0] == S9L.W1E(1868) || t7V[7][0] == "/balanceall"'); newStr = newStr.replace('t7V[67]=t7V[97];break;', BALANCE_SELECTION); newStr = newStr.replace('parseInt(t7V[7][2]);', 'parseInt(t7V[7][t7V[7][0] == "/balanceall" ? 1 : 2]);') newStr = newStr.replace('if(t7V[95] == 0)', BALANCE_ALL_MESSAGE); newStr = newStr.replace('if(t7V[7][0] == S9L.W1E(1868', CUSTOM_COMMANDS+'else if(t7V[7][0] == S9L.W1E(1868'); newStr = newStr.replace('j0V[69][t7V[3][644]](S9L.W1E(1896),S9L.C1E(1870),false);', 'j0V[69][t7V[3][644]](S9L.W1E(1896),S9L.C1E(1870),false);j0V[69][t7V[3][644]]("/hhelp - commands from host extension",S9L.C1E(1870),false);'); console.log("Bonk Host injector run"); return newStr; } if(!window.bonkCodeInjectors) window.bonkCodeInjectors = []; window.bonkCodeInjectors.push(bonkCode => { try { return injector(bonkCode); } catch (error) { alert( `Whoops! Bonk Host was unable to load. This may be due to an update to Bonk.io. If so, please report this error! This could also be because you have an extension that is incompatible with \ Bonk Host, such as the Bonk Leagues Client. You would have to disable it to use \ Bonk Host.`); throw error; } }); console.log("Bonk Host injector loaded");