TETR.IO Theme

Nullpomino Theme for Jstris

As of 2020-02-03. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         TETR.IO Theme
// @namespace    http://tampermonkey.net/
// @version      0.14
// @description  Nullpomino Theme for Jstris
// @author       Eddie, NueSB, Oki, OSK
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

(function() {

    function CustomSFXset(){
    this.volume=1;
    this.lock={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_lock.mp3",abs:1};
    this.ready={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/goodluckyready.mp3",abs:1,set:1};
    this.go={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/goodluckygo.mp3",abs:1,set:0};
    this.died={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_died.mp3",abs:1,set:1};
    this.hold={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_hold.mp3",abs:1,set:0};
    this.move={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_move.mp3",abs:1,set:0};
    this.linefall={url:"blank.wav",abs:1,set:0};
    this.comboTones={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_combo.mp3",abs:1,set:2,duration:1000,spacing:500,cnt:17};
    };

    window.addEventListener('load', function(){

        //Next Piece Sounds
        var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
        Game['pieceSoundsTGM'] = [];
        var srcs = [
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_imino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_omino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_tmino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_lmino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_jmino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_smino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_zmino.mp3",
          "https://ecdldaiiere.github.io/Eddiez-Soundz/goodlucky_idk.wav"
        ];

        Game['playSoundTGM'] = function(s)
        {
          if (!s.paused && s.currentTime > 0)
          {
            s.currentTime = 0;
          }
          else s.play();
        }

        function a(s, b)
        {
          for (var i = 0; i < b.length; i++)
          {
            s.push(document.createElement("audio"));
            s[i].src = b[i];
            s[i].volume = 0.43;
          }
        }
        a(Game['pieceSoundsTGM'], srcs);


        var uqbFunc = Game['prototype']['updateQueueBox'].toString()
        uqbFunc = "Game['playSoundTGM'](Game['pieceSoundsTGM'][this.queue[0].id]);" + trim(uqbFunc)
        Game['prototype']['updateQueueBox'] = new Function(uqbFunc);

        //Jstris SFX
        CustomSFXset.prototype = new BaseSFXset;
        loadSFX(new CustomSFXset);

        //Jstris Block Skin Change
        loadSkin("https://i.imgur.com/XcnWlC6.png",30);
        loadGhostSkin("https://i.imgur.com/f7kvOMi.png",30);

        //Jstris Custom Background Image
        document.head.getElementsByTagName("style")[0].innerHTML="";
        document.body.style.backgroundImage="url('https://i.imgur.com/tgQkAX5.jpg)";
        document.body.style.backgroundSize="100%";
        document.getElementById("app").style.backgroundColor="rgba(0, 0, 0, 0)";
        document.getElementById("app").style.height="1000px";


/**************************
  Rotation Sounds Script
**************************/

Game['rotationSounds']  = [
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_rotate.mp3", //rotate left
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_rotate.mp3", //rotate right
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_rotate.mp3" //rotate 180°
];

Game['rotationVolumes'] = [1,1,1]

localStorage.evVol=localStorage.evVol||"100"

Game["rArray"]=[];
Game["rotationSounds"].map((x,i)=>{if(Game['rotationSounds'][i]){Game["rArray"].push(document.createElement("audio"));Game["rArray"][i].src=x}else{Game["rArray"].push(null)}})


window.playRotSound = function(S){s=Game.rArray[S];!s.paused&&0<s.currentTime?s.currentTime=0:(s.volume=Game['rotationVolumes'][S]*localStorage.evVol/100,s.play())}


var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}

var rotFunc = Game['prototype']['rotateCurrentBlock'].toString()
var rotParams = getParams(rotFunc)

var rotInsert = 'var rotPos=[0,0,1,2]['+rotParams[0]+'+1];console.log(rotPos);Game.rArray[rotPos]&&playRotSound(rotPos);'

rotFunc = rotInsert + trim(rotFunc)

Game['prototype']['rotateCurrentBlock'] = new Function(...rotParams, rotFunc);


/**************************
  Special Events Script
**************************/
Game['eventSounds']  = [
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_tspinsingle.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_tspinsingle.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_clear1.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_tspindouble.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_clear2.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_tspintriple.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_clear3.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_clear4.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_clear5.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_perfectclear.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_tspindouble.mp3",
"https://ecdldaiiere.github.io/Eddiez-Soundz/Tetrio_b2btetris.mp3"
];

Game['eventVolumes']  = [1,1,1,1,1,1,1,1,1,1,1,1]


window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]
window.enableB2B = true;


Game["latestEv"]="";Game["sArray"]=[];localStorage.evVol=localStorage.evVol||"100";window.b2bBefore=false;
Game["eventSounds"].map((x,i)=>{if(Game['eventSounds'][i]){Game["sArray"].push(document.createElement("audio"));Game["sArray"][i].src=x}else{Game["sArray"].push(null)}})


var evVol = document.createElement("tr");
evVol.innerHTML = `Special Events vol:&nbsp;<input id="volControl3" oninput="localStorage.evVol=volControl3.value;volSetting3.innerHTML=volControl3.value+'%'" type="range" min="0" max="100" value="`+localStorage.evVol+`" step="1" style="width:150px;display:inline-block;padding-top:9px">&nbsp;&nbsp;<span id="volSetting3">`+localStorage.evVol+`%</span>`
tab_appear.appendChild(evVol);

if(typeof playSound != 'function') {
    window.playSound = function(S){s=Game.sArray[S];console.log(s);!s.paused&&0<s.currentTime?s.currentTime=0:(s.volume=Game['eventVolumes'][S]*localStorage.evVol/100,s.play())}
}


window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]

if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}


var clcFunc = Game['prototype']['checkLineClears'].toString()
var clcParams = getParams(clcFunc)
searchFor = "[_" + clcFunc.split("switch")[1].split("]][_")[2]

events.map((x,i)=>{
	replacement = searchFor.replace("[","[Game['btb']=this['isBack2Back'],console.log('"+x+"'),Game['latestEv']='"+x+"',")
	clcFunc=clcFunc.replace(searchFor,replacement)
})

Game['prototype']["checkLineClears"] = new Function(...clcParams, trim(clcFunc));

var psFunc = Game['prototype']['playSound'].toString()
var psParams = getParams(psFunc);
psFunc = `
if(Game["latestEv"]){
	sIndex=events.indexOf(Game["latestEv"]);
	console.log(sIndex)
	sound=sIndex;enableB2B&&Game.btb&&~[0,1,3,5,7,8].indexOf(sIndex)&&(sound=10+ +(7==sIndex));
	console.log(sound);
	Game.sArray[sound]&&playSound(sound);
	Game["latestEv"]="";
}` + trim(psFunc)

Game['prototype']['playSound'] = new Function(...psParams, psFunc);

localStorage.mainVol = localStorage.mainVol || "100"
document.getElementById("settingsSave").addEventListener("click", function(){
    localStorage.mainVol=document.getElementById('vol-control').value
}, false);

Settings['prototype']['volumeChange'](+localStorage.mainVol)


    }

  )();
})();