WWC Theme

Worldwide Combos for Jstris

  1. // ==UserScript==
  2. // @name WWC Theme
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.23
  5. // @description Worldwide Combos for Jstris
  6. // @author Eddie
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. window.addEventListener('load', function(){
  15.  
  16. //Jstris Block Skin Change
  17. loadSkin("https://i.imgur.com/zpD5v7L.png",36);
  18. loadGhostSkin("https://i.imgur.com/w6yagIT.png",36);
  19.  
  20. //Jstris Custom Background Image
  21. document.head.getElementsByTagName("style")[0].innerHTML="";
  22. document.body.style.backgroundImage="url('https://i.imgur.com/Inu1RkB.jpg')";
  23. document.body.style.backgroundSize="100% 100%";
  24. document.getElementById("app").style.backgroundColor="rgba(0, 0, 0, 0)";
  25. document.getElementById("app").style.height="1000px";
  26. //Jstris SFX
  27. CustomSFXset.prototype = new BaseSFXset;
  28. loadSFX(new CustomSFXset);
  29.  
  30. });
  31. })();
  32.  
  33. function CustomSFXset(){
  34. this.volume=1;
  35. this.lock={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_lock.wav",abs:1};
  36. this.ready={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_ready.wav",abs:1,set:1};
  37. this.go={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_go.wav",abs:1,set:0};
  38. this.died={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_died.wav",abs:1,set:1};
  39. this.hold={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_hold.wav",abs:1,set:0};
  40. this.move={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_move.mp3",abs:1,set:0};
  41. this.linefall={url:"blank.wav",abs:1,set:0};
  42. };
  43.  
  44. /**************************
  45. Opponent's Color Script
  46. **************************/
  47.  
  48. var customStyle2=document.createElement("style");
  49. customStyle2.innerHTML='.slot span a {color:rgba(255, 255, 255, 100);} .slot span {color:rgba(160, 160, 160, 100);}';
  50. document.body.appendChild(customStyle2);
  51.  
  52. /**************************
  53. Special Events Script
  54. **************************/
  55. (function() {
  56. window.addEventListener('load', function(){
  57.  
  58. Game['eventSounds'] = [
  59. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear1.mp3",
  60. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear1.mp3",
  61. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear1.mp3",
  62. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear2.mp3",
  63. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear2.mp3",
  64. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear3.mp3",
  65. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear3.mp3",
  66. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear4.mp3",
  67. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear5.mp3",
  68. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_perfectclear.wav",
  69. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear2.mp3",
  70. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_clear4.mp3"
  71. ];
  72.  
  73. Game['eventVolumes'] = [1,1,1,1,1,1,1,1,1,1,1,1]
  74.  
  75.  
  76. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]
  77. window.enableB2B = true;
  78.  
  79.  
  80. Game["latestEv"]="";Game["sArray"]=[];localStorage.evVol=localStorage.evVol||"100";window.b2bBefore=false;
  81. 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)}})
  82.  
  83.  
  84. var evVol = document.createElement("tr");
  85. 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>`
  86. tab_sound.appendChild(evVol);
  87.  
  88. if(typeof playSound != 'function') {
  89. 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())}
  90. }
  91.  
  92.  
  93. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]
  94.  
  95. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  96. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  97.  
  98.  
  99. var clcFunc = Game['prototype']['checkLineClears'].toString()
  100. var clcParams = getParams(clcFunc)
  101. searchFor = "[_" + clcFunc.split("switch")[1].split("]][_")[2]
  102.  
  103. events.map((x,i)=>{
  104. replacement = searchFor.replace("[","[Game['btb']=this['isBack2Back'],console.log('"+x+"'),Game['latestEv']='"+x+"',")
  105. clcFunc=clcFunc.replace(searchFor,replacement)
  106. })
  107.  
  108. Game['prototype']["checkLineClears"] = new Function(...clcParams, trim(clcFunc));
  109.  
  110. var psFunc = Game['prototype']['playSound'].toString()
  111. var psParams = getParams(psFunc);
  112. psFunc = `
  113. if(Game["latestEv"]){
  114. sIndex=events.indexOf(Game["latestEv"]);
  115. console.log(sIndex)
  116. sound=sIndex;enableB2B&&Game.btb&&~[0,1,3,5,7,8].indexOf(sIndex)&&(sound=10+ +(7==sIndex));
  117. console.log(sound);
  118. Game.sArray[sound]&&playSound(sound);
  119. Game["latestEv"]="";
  120. }` + trim(psFunc)
  121.  
  122. Game['prototype']['playSound'] = new Function(...psParams, psFunc);
  123.  
  124. localStorage.mainVol = localStorage.mainVol || "100"
  125. document.getElementById("settingsSave").addEventListener("click", function(){
  126. localStorage.mainVol=document.getElementById('vol-control').value
  127. }, false);
  128.  
  129. Settings['prototype']['volumeChange'](+localStorage.mainVol)
  130.  
  131. /**************************
  132. Rotation Sounds Script
  133. **************************/
  134.  
  135. Game['rotationSounds'] = [
  136. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_rotate.mp3", //rotate left
  137. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_rotate.mp3", //rotate right
  138. "https://ecdldaiiere.github.io/Eddiez-Soundz/WWC_rotate.mp3" //rotate 180°
  139. ];
  140.  
  141. Game['rotationVolumes'] = [1,1,1]
  142.  
  143. localStorage.evVol=localStorage.evVol||"100"
  144.  
  145. Game["rArray"]=[];
  146. 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)}})
  147.  
  148.  
  149. 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())}
  150.  
  151.  
  152. var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
  153. var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}
  154.  
  155. var rotFunc = Game['prototype']['rotateCurrentBlock'].toString()
  156. var rotParams = getParams(rotFunc)
  157.  
  158. var rotInsert = 'var rotPos=[0,0,1,2]['+rotParams[0]+'+1];console.log(rotPos);Game.rArray[rotPos]&&playRotSound(rotPos);'
  159.  
  160. rotFunc = rotInsert + trim(rotFunc)
  161.  
  162. Game['prototype']['rotateCurrentBlock'] = new Function(...rotParams, rotFunc);
  163.  
  164. });
  165. })();