splixHax Vbetter

better than other splix hacks

目前為 2019-04-23 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         splixHax Vbetter
// @namespace    http://tampermonkey.net/
// @version      14.7
// @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=myPlayer;
    };
    window.addEventListener("hashchange",function(){
if(serverSel!=null&&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>'+(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[selectedGamemode.startsWith("N")?0:1].versions[0].lobbies[0].hash+'"'+(selectedGamemode.startsWith("N")?"":" disabled")+'>'+srv.gamemodes[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==myPlayer)return;
        myPlayer.isMyPlayer=false;
        myOldPlayer.isMyPlayer=true;
        myPlayer=myOldPlayer;
        lstPlyrIndx=players.indexOf(myPlayer);
        return;
      }
      if(lstPlyrIndx==-1)lstPlyrIndx=players.indexOf(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;
      myPlayer.trails=[];
      myPlayer=players[lstPlyrIndx];
      myPlayer.trails=[];
      return 'now spectating "'+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==myPlayer){
                document.title=spectate();
                sendDir(4);
              }
              break;
              case "e":
              myPlayer.addHitLine(myPlayer.pos,myColorId);
              sendDir(4);
              break;
            }
            if("y".split("").includes(e.key)){
              if(e.key=="y"?myOldPlayer==myPlayer:true)myPlayer.addHitLine(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);
                    myPlayer.addHitLine(myPlayer.pos,myColorId);
                    break;
                case "e":
                    if(confirm("are you sure you would like to eat the entire universe?"))myPlayer.doHonk(Infinity);
                    break;
            }
            if("hgft".split("").includes(e.key)){
                myPlayer.addHitLine(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(!isConnectingWithTransition&&myPlayer!=null&&myOldPlayer!=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(myPlayer==null)return;
          if(myOldPlayer==null)myOldPlayer=myPlayer;
          tmpColId=myColorId;
          while(myColorId==tmpColId)myColorId=Math.floor(Math.random()*13);
          tmpColId=myColorId;
          myPlayer.skinBlock=(high|!dark)?myColorId:13;
          if(high)myColorId=13;
          colorUI();
          if(high){
            myColorId=tmpColId;
            //toggleUglyMode();
          }
          //make other players stoopid
          players.filter(v=>v!=myPlayer&&!v.name.startsWith('[stoopid] ')&&v!=myOldPlayer).forEach(v=>v.name="[stoopid] "+v.name);
          players.filter(v=>v!=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(selectedGamemode==null)return;
        if(prevGameMode==null)prevGameMode=selectedGamemode;
        if(prevGameMode!=selectedGamemode){
          prevGameMode=selectedGamemode;
          selUpd();
        }
        if(myPlayer==null)return;
        if(myOldPlayer==null||(myPlayer!=myOldPlayer&&myPlayer.id==myOldPlayer.id))myOldPlayer=myPlayer;
        if(spam)myPlayer.doHonk(16);
        if(myPlayer.isDead){
          if(myPlayer==myOldPlayer){
            if(myPlayer.deathWasCertain)sendDir(4);
            myPlayer.undoDie();
            myPlayer.deathWasCertain=false;
            //doSkipDeathTransition();
          }else if(myOldPlayer.isDead){
            //myOldPlayer=myPlayer=null;
            setTimeout(()=>myOldPlayer=myPlayer=null,100);
            myPlayer.undoDie();
            //myPlayer.deathWasCertain=false;
            spectate(1);
            if(myPlayer.deathWasCertain)sendDir(4);
            myPlayer.deathWasCertain=false;
          }else{spectate();}
        }
        if(high)myPlayer.die();
        if(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>";
})();