Cheese Pace Script

Predicts cheese time/block count

当前为 2020-02-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Cheese Pace Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Predicts cheese time/block count
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /**************************
  12. Cheese Pace Script
  13. **************************/
  14.  
  15. (function() {
  16. window.addEventListener('load', function(){
  17.  
  18.  
  19. url = window.location.href
  20. if(~url.indexOf("play=3")){
  21.  
  22.  
  23. var rect = holdCanvas.getBoundingClientRect();
  24. var p = document.createElement("div");
  25. p.id = "pace"
  26. p.style = ("color:#999;width:150px;position:absolute;top:"+(rect.top+400)+"px;left:"+(rect.left-50)+"px")
  27. p.innerHTML = `
  28. <table style='width:100%;height:100%;table-layout:fixed;'>
  29. <tr>
  30. <th style='text-align:center' colspan="2">Pace:</th>
  31. </tr>
  32. <tr>
  33. <td>Time:</td>
  34. <td id='paceTime'>0</td>
  35. </tr>
  36. <tr>
  37. <td># </td>
  38. <td id='pacePieces'>0</td>
  39. </tr>
  40. </table>
  41. `
  42. document.body.appendChild(p);
  43.  
  44.  
  45. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  46.  
  47. //var readyGoFunc = Game['prototype']["startReadyGo"].toString()
  48. var queueBoxFunc = Game['prototype']['updateQueueBox'].toString()
  49.  
  50. function formatTime(seconds) {
  51. m = Math.floor(seconds / 60)
  52. s = Math.floor(seconds % 60)
  53. ms = Math.floor((seconds % 1)*100)
  54. return (m?(m+":"):'')+("0"+s).slice(-2)+"."+("0"+ms).slice(-2)
  55. }
  56.  
  57. function paces() {
  58. console.log(this);
  59.  
  60. totalLines = this["cheeseModes"][this["sprintMode"]]
  61. linesLeft = lrem.innerHTML
  62. linesCleared = totalLines - linesLeft
  63.  
  64. timePace = ((totalLines/linesCleared) * this["clock"])
  65. piecePace = ((linesLeft/linesCleared)*this["placedBlocks"] + this["placedBlocks"])
  66.  
  67. paceTime.innerHTML= (timePace*0+1)?formatTime(timePace):'0';
  68. pacePieces.innerHTML= (piecePace*0+1)?Math.floor(piecePace):'0';
  69. }
  70.  
  71. //readyGoFunc = "paceTime.innerHTML='0',pacePieces.innerHTML='0';" + trim(readyGoFunc)
  72. queueBoxFunc = trim(paces.toString()) + trim(queueBoxFunc);
  73.  
  74. //Game['prototype']["startReadyGo"] = new Function(readyGoFunc);
  75. Game['prototype']["updateQueueBox"] = new Function(queueBoxFunc);
  76.  
  77. }
  78.  
  79. });
  80. })();