 
        Greasy Fork is available in English.
A userscript to add additional alerts in chat
当前为 
// ==UserScript==
// @name         Bonk Kicked Alert
// @version      1.1.2
// @author       Blu
// @description  A userscript to add additional alerts in chat
// @match        https://bonk.io/gameframe-release.html
// @run-at       document-start
// @grant        none
// @namespace http://greasyfork.icu/users/826975
// ==/UserScript==
// for use as a userscript ensure you have Excigma's code injector userscript
// http://greasyfork.icu/en/scripts/433861-code-injector-bonk-io
const injectorName = `BonkKicked`;
const errorMsg = `Whoops! ${injectorName} 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 \
${injectorName}`;
function injector(src){
  let newSrc = src;
  
  // on recv packet 24, handle player kicked when ingame or in lobby
  newSrc = newSrc.replace(`i9a[2]=X8tDL;`, `$&
    let playerArr = F21[20];
    let player = playerArr[arguments[0]];
    
    let lobby = F21[90];
    let ingame = F21[51];
    if (lobby) lobby.showStatusMessage("* " + player.userName + " was KICKED!", "#cc3333", false);
    if (ingame) ingame.chatStatus("* " + player.userName + " was KICKED!");`);
  
  // on recv packet 40, handle player record
  newSrc = newSrc.replace(`H1N.L77(2271)`, `$& + " by " + S$w[80].playerArray[arguments[0]].userName`);
  
  // on recv packet 29, handle map updated
  newSrc = newSrc.replace(`D$s[8]=X8tDL;`, `$&
    if(arguments[0].m.n.includes(' (edit)')){
      let lobby = F21[90];
      let ingame = F21[51];
      if (lobby) lobby.showStatusMessage("* Host edited map", "#cc3333", false);
      if (ingame) ingame.chatStatus("* Host edited map");
    }`);
  
  // on recv packet 29, ignore GMMODE update mode packets
  newSrc = newSrc.replace(/[\w$]{3}\[[0-9]\]=\w\[[\w$]{3}\[[0-9]\]\[[0-9]{3}\]\]\([\w$]{3}\[0\]\[0\]\);[\w$]{3}\(/, `if(arguments[0].startsWith("!!!GMMODE!!!")) return; $&`);
  
  if(src === newSrc) throw "Injection failed!";
  console.log(injectorName+" injector run");
  return newSrc;
}
// Compatibility with Excigma's code injector userscript
if(!window.bonkCodeInjectors) window.bonkCodeInjectors = [];
window.bonkCodeInjectors.push(bonkCode => {
	try {
		return injector(bonkCode);
	} catch (error) {
		alert(errorMsg);
		throw error;
	}
});
console.log(injectorName+" injector loaded");