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.2
  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 queueBoxFunc = Game['prototype']['updateQueueBox'].toString()
  48.  
  49. window.formatTime = function(seconds) {
  50. m = Math.floor(seconds / 60)
  51. s = Math.floor(seconds % 60)
  52. ms = Math.floor((seconds % 1)*100)
  53. return (m?(m+":"):'')+("0"+s).slice(-2)+"."+("0"+ms).slice(-2)
  54. }
  55.  
  56. function paces() {
  57. console.log(this);
  58.  
  59. totalLines = this["cheeseModes"][this["sprintMode"]]
  60. linesLeft = lrem.innerHTML
  61. linesCleared = totalLines - linesLeft
  62.  
  63. timePace = ((totalLines/linesCleared) * this["clock"])
  64. piecePace = ((linesLeft/linesCleared)*this["placedBlocks"] + this["placedBlocks"])
  65.  
  66. paceTime.innerHTML= (timePace*0+1)?formatTime(timePace):'0';
  67. pacePieces.innerHTML= (piecePace*0+1)?Math.floor(piecePace):'0';
  68. }
  69.  
  70. queueBoxFunc = trim(paces.toString()) + trim(queueBoxFunc);
  71. Game['prototype']["updateQueueBox"] = new Function(queueBoxFunc);
  72.  
  73. }
  74.  
  75. });
  76. })();