// ==UserScript==
// @name splixHax Vbetter
// @namespace http://tampermonkey.net/
// @version 14.9
// @description better than other splix hacks
// @author You
// @match *://splix.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.serverSel=null;
window.addEventListener('load',function(){
MAX_ZOOM=10000;
USERNAME_SIZE=6;
var defzm=BLOCKS_ON_SCREEN,zm=1;
window.addEventListener('wheel',function(e){
if(document.activeElement.tagName=="input")return;
zm+=e.deltaY/Math.abs(e.deltaY)*.5;
if(defzm*zm>16000)zm-=.5;
if(defzm*zm<100)zm+=.5;
BLOCKS_ON_SCREEN=defzm*zm;
});
trackGameStart=function(){
sendDir(4);
setTimeout(()=>sendDir(4),0);
setTimeout(()=>sendDir(4),125);
setTimeout(()=>sendDir(4),250);
setTimeout(()=>sendDir(4),375);
setTimeout(()=>sendDir(4),500);
myOldPlayer=window.myPlayer;
};
window.addEventListener("hashchange",function(){
if(serverSel!=null&&window.selectedGamemode.startsWith("N")&&"#"+serverSel.value!=window.location.hash)window.selUpd();
},false);
window.selUpd=()=>{
if(serverSel==null)return;
var sv=serverSel.selectedIndex;
serverSel.outerHTML="";
setTimeout(async ()=>{
while(!serversRequestDone)await new Promise(r=>setTimeout(r,1));
window.createServerSelectPls(true,sv);
},100);
};
formElem.appendChild(document.createElement("BR"));
window.createServerSelectPls=function(aa,bb){
window.serverSel=document.createElement("SELECT");
serverSel.className="fancyBox inputFancy";
var tobesrvselectinnerhtml='<option value="" hidden disabled selected>'+(window.selectedGamemode.startsWith("N")?('Select a server... (Current: '+(window.location.hash.length<2?'auto':window.location.hash.slice(1))+')</option><option value="">auto'):'Possible Servers: ')+'</option>';
serverSel.onchange=function(){if(serverSel.value==""){history.replaceState(null,null,' ');}else{window.location.hash=serverSel.value;}};
formElem.appendChild(serverSel);
window.servers.forEach((srv,indx)=>{
tobesrvselectinnerhtml+='<option value="'+srv.gamemodes[window.selectedGamemode.startsWith("N")?0:1].versions[0].lobbies[0].hash+'"'+(window.selectedGamemode.startsWith("N")?"":" disabled")+'>'+srv.gamemodes[window.selectedGamemode.startsWith("N")?0:1].versions[0].lobbies[0].hash+' ('+srv.loc+')</option>';
if(indx+1==window.servers.length){
serverSel.innerHTML=tobesrvselectinnerhtml;
if(aa&&[...serverSel.options].some(e=>e.value==window.location.hash.slice(1)))serverSel.value=window.location.hash.slice(1);
if(bb==0)serverSel.selectedIndex=0;
}
});
};
(async ()=>{
while(!serversRequestDone)await new Promise(r=>setTimeout(r,1));
window.createServerSelectPls(false,0);
})();
tutorialPlayers[0].name="splixHax vBetter";
tutorialPlayers[1].name="better than other splix hacks";
});
window.myOldPlayer=null;
window.macroMaker=function(k,s){
if(typeof k=="undefined"||typeof s=="undefined")return "1st arg=array of nums (see desc. for more info), 2nd arg=milliseconds between presses";
for(var i=0;i<k.length;i++){
if(k[i]==5){
setTimeout(()=>{honkStart();honkEnd();},s*i);
}else if(k[i]==6){
//do nothing
}else{
setTimeout(a=>sendDir(a),s*i,k[i]);
}
}
};
window.spectate=function(back){
pressedKeys=[];
if(typeof back!="undefined"&&back){
if(myOldPlayer==window.myPlayer)return;
window.myPlayer.isMyPlayer=false;
myOldPlayer.isMyPlayer=true;
window.myPlayer=myOldPlayer;
lstPlyrIndx=players.indexOf(window.myPlayer);
return;
}
if(lstPlyrIndx==-1)lstPlyrIndx=players.indexOf(window.myPlayer);
if(players.length<2)return "error: there is nobody else nearby to spectate";
players[lstPlyrIndx].isMyPlayer=false;
lstPlyrIndx+=1;
if(lstPlyrIndx>=players.length)lstPlyrIndx=0;
players[lstPlyrIndx].isMyPlayer=true;
window.myPlayer.trails=[];
window.myPlayer=players[lstPlyrIndx];
window.myPlayer.trails=[];
return 'now spectating "'+window.myPlayer.name+'"';
}
var lstPlyrIndx=-1,high=false,spam=false,dark=false,keyHandler=function(e){
if(e.keyCode>=112&&e.keyCode<=121&&e.keyCode!=116)return e.preventDefault();
if(document.activeElement.tagName=="input")return;
if(e.type.endsWith("n")){
switch(e.key){
case "y":
if(myOldPlayer==window.myPlayer){
document.title=spectate();
sendDir(4);
}
break;
case "e":
window.myPlayer.addHitLine(window.myPlayer.pos,myColorId);
sendDir(4);
break;
}
if("y".split("").includes(e.key)){
if(e.key=="y"?myOldPlayer==window.myPlayer:true)window.myPlayer.addHitLine(window.myPlayer.pos,myColorId);
resetTitle();
}
};
if(e.type.endsWith("p")){
//wsSendMsg(sendAction.REQUEST_MY_TRAIL);
switch(e.key){
case "h":
high=!high;
document.title="high mode "+(high?"en":"dis")+"abled";
break;
case "g":
spam=!spam;
document.title="spam mode "+(spam?"en":"dis")+"abled";
break;
case "f":
GLOBAL_SPEED=.006+(+(GLOBAL_SPEED==.006))*.00075;
document.title="speed mode "+(GLOBAL_SPEED==.006?"dis":"en")+"abled";
break;
case "t":
dark=!dark;
document.title="dark mode "+(dark?"en":"dis")+"abled";
break;
case "y":
spectate(1);
window.myPlayer.addHitLine(window.myPlayer.pos,myColorId);
break;
case "e":
if(confirm("are you sure you would like to eat the entire universe?"))window.myPlayer.doHonk(Infinity);
break;
}
if("hgft".split("").includes(e.key)){
window.myPlayer.addHitLine(window.myPlayer.pos,myColorId);
resetTitle();
}
}
};
var setTitleInterval=-1;
function resetTitle(){
clearInterval(setTitleInterval);
setTitleInterval=setTimeout(()=>{
document.title="splix.io";
setTitleInterval=-1;
},3000);
}
window.addEventListener('keydown',keyHandler);
window.addEventListener('keyup',keyHandler);
var tmpColId;
setInterval(()=>{if(!window.isConnectingWithTransition&&window.myPlayer!=null&&myOldPlayer!=window.myPlayer)spectate();},3000);
setInterval(()=>{
var tmpSkinBlock=Math.floor(Math.random()*13);
tutorialPlayers[0].skinBlock=tmpSkinBlock;
tutorialPlayers[1].skinBlock=12-tmpSkinBlock;
tutorialPlayers[0].doHonk(128);
tutorialPlayers[1].doHonk(128);
if(window.myPlayer==null)return;
if(myOldPlayer==null)myOldPlayer=window.myPlayer;
tmpColId=myColorId;
while(myColorId==tmpColId)myColorId=Math.floor(Math.random()*13);
tmpColId=myColorId;
window.myPlayer.skinBlock=(high|!dark)?myColorId:13;
if(high)myColorId=13;
colorUI();
if(high){
myColorId=tmpColId;
//toggleUglyMode();
}
//make other players stoopid
players.filter(v=>v!=window.myPlayer&&!v.name.startsWith('[stoopid] ')&&v!=myOldPlayer).forEach(v=>v.name="[stoopid] "+v.name);
players.filter(v=>v!=window.myPlayer&&v!=myOldPlayer).forEach(v=>{v.skinBlock=high?13:myColorId;});
},1000);
var prevGameMode=null;
setInterval(()=>{if(spam)wsSendMsg(sendAction.HONK,128);},10);
setInterval(async ()=>{
if(window.selectedGamemode==null)return;
if(prevGameMode==null)prevGameMode=window.selectedGamemode;
if(prevGameMode!=window.selectedGamemode){
prevGameMode=window.selectedGamemode;
selUpd();
}
if(window.myPlayer==null)return;
if(myOldPlayer==null||(window.myPlayer!=myOldPlayer&&window.myPlayer.id==myOldPlayer.id))myOldPlayer=window.myPlayer;
if(spam)window.myPlayer.doHonk(16);
if(window.myPlayer.isDead){
if(window.myPlayer==myOldPlayer){
if(window.myPlayer.deathWasCertain)sendDir(4);
window.myPlayer.undoDie();
window.myPlayer.deathWasCertain=false;
//doSkipDeathTransition();
}else if(myOldPlayer.isDead){
//myOldPlayer=window.myPlayer=null;
setTimeout(()=>myOldPlayer=myPlayer=null,100);
window.myPlayer.undoDie();
//window.myPlayer.deathWasCertain=false;
spectate(1);
if(window.myPlayer.deathWasCertain)sendDir(4);
window.myPlayer.deathWasCertain=false;
}else{spectate();}
}
if(high)window.myPlayer.die();
if(window.myPlayer!=myOldPlayer)pressedKeys=[];
clearTimeout(deathTransitionTimeout);
if(pressedKeys.includes(27))doTransition("Despacito",true,null,()=>{window.setTimeout(afterDeath,250);onClose();resetAll();},true);
},0);
document.head.innerHTML+="<style>#playUI>*{transition:all .5s linear;}#miniMap{transform-origin:top left;transform:scale(1.25,1.25);}select:not(#gamemodeSelect){padding-right:1.5em;background:url(/img/arrowD.svg) right center no-repeat #3bad48;color:#fff;background-size:30px;}</style>";
})();