fernozzle

OWOT Retard Paste

Nov 30th, 2023
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. if (!localStorage["Test.typing.chars"]) {
  2. localStorage["Test.typing.chars"] = 0;
  3. localStorage["Test.typing.chars.bonus"] = 0;
  4. }
  5. YourWorld.Color = 0x008000;
  6. var coords = [0,0];
  7. var prevCoords = [0,0];
  8. var prevText = [];
  9. var previousLine = cursorCoords;
  10. var canSkip = 0;
  11. var typingStreak = 0;
  12. var typed = document.createElement("div");
  13. var progressFill = document.createElement("div");
  14. var progress = document.createElement("meter");
  15. typed.innerHTML = `${parseFloat(localStorage["Test.typing.chars"]).toLocaleString("en-US")} typed (+${parseFloat(localStorage["Test.typing.chars.bonus"]).toLocaleString("en-US")})`;
  16. typed.style = "position: absolute; top: 0; left: 0; width: 100%; height: 64px; text-align: center; background: #00000080; color: white; font-size: 48px; font-family: arial;";
  17. progressFill.style = "position: absolute; top: calc(100% - 32px); left: 0; width: 100%; height: 32px; background: #00000080";
  18. progress.style = "position: absolute; width: 95%; left: 2.5%; top: calc(100% - 24px)";
  19. progress.value = 0;
  20. main_view.appendChild(typed);
  21. main_view.appendChild(progress);
  22. main_view.appendChild(progressFill);
  23. state.userModel.username = (parseFloat(localStorage["Test.typing.chars"]) + parseFloat(localStorage["Test.typing.chars.bonus"])).toLocaleString("en-US");
  24. updateText = () => {
  25. prevText = [
  26. getCharInfoXY(coords[0],coords[1]),
  27. getCharInfoXY(coords[0],coords[1]+1),
  28. [],
  29. ];
  30. for (let i = 0; i < state.userModel.username.length; i++) {
  31. prevText[2].push(getCharInfoXY(coords[0]+i,coords[1]+2));
  32. }
  33. }
  34. updateCoords = () => {
  35. if (!cursorCoords) {
  36. return false;
  37. }
  38. coords = [cursorCoords[0]*16 + cursorCoords[2], cursorCoords[1]*8 + cursorCoords[3]];
  39. }
  40. update = (e,f,g) => {
  41. if (prevText[0].char == f && prevText[0].color != 0x008000) {
  42. moveCursor("right");
  43. prevText[0].color = 0x008000;
  44. if (g) {
  45. localStorage["Test.typing.chars.bonus"]++;
  46. } else {
  47. localStorage["Test.typing.chars"]++;
  48. canSkip = canSkip == 1000 ? 1000 : canSkip + 1;
  49. typingStreak++;
  50. progress.value = canSkip/1000;
  51. progress.style.filter = `hue-rotate(${~~(canSkip/100)*36}deg) brightness(${1+~~(canSkip/100)/10})`;
  52. YourWorld.Color = canSkip >= 100 ? 0x60C000 + ~~(canSkip/4) : 0x008000;
  53. }
  54. typed.innerHTML = `${parseFloat(localStorage["Test.typing.chars"]).toLocaleString("en-US")} typed (+${parseFloat(localStorage["Test.typing.chars.bonus"]).toLocaleString("en-US")})`;
  55. state.userModel.username = (parseFloat(localStorage["Test.typing.chars"]) + parseFloat(localStorage["Test.typing.chars.bonus"])).toLocaleString("en-US");
  56. }
  57. updateCoords();
  58. if (coords == prevCoords) {
  59. return false;
  60. }
  61. if (coords[0] != prevCoords[0]+1 || e) {
  62. writeCharToXY(prevText[0].char,prevText[0].color,prevCoords[0],prevCoords[1]);
  63. }
  64. writeCharToXY(prevText[1].char,prevText[1].color,prevCoords[0],prevCoords[1]+1);
  65. for (let i = 0; i < prevText[2].length; i++) {
  66. writeCharToXY(prevText[2][i].char,prevText[2][i].color,prevCoords[0]+i,prevCoords[1]+2);
  67. }
  68. updateText();
  69. writeCharToXY("â–ˆ",YourWorld.Color,coords[0],coords[1]);
  70. writeCharToXY("|",0,coords[0],coords[1]+1);
  71. for (let i = 0; i < state.userModel.username.length; i++) {
  72. writeCharToXY(state.userModel.username[i],0,coords[0]+i,coords[1]+2);
  73. }
  74. prevCoords = coords;
  75. }
  76. skip = () => {
  77. let interval = setInterval(() => {
  78. update(1,prevText[0].char,1);
  79. if (prevText[0].char == " " || prevText[0].color == 0x008000) {
  80. clearInterval(interval);
  81. YourWorld.Color = canSkip >= 100 ? 0x60C000 + ~~(canSkip/4) : 0x008000;
  82. }
  83. });
  84. }
  85. onkeydown = e => {
  86. if (e.key.length == 1) {
  87. update(1,e.key);
  88. } else if (e.key == "Tab" && canSkip >= 100) {
  89. skip();
  90. canSkip -= 100;
  91. progress.value = canSkip/1000;
  92. progress.style.filter = `hue-rotate(${~~(canSkip/100)*36}deg) brightness(${1+~~(canSkip/100)/10})`;
  93. YourWorld.Color = 0xFFBF00;
  94. } else if (e.key == "Enter") {
  95. cursorCoords = previousLine;
  96. moveCursor("down");
  97. previousLine = cursorCoords;
  98. } else if (e.key != "Shift" && e.key != "CapsLock") {
  99. previousLine = cursorCoords;
  100. }
  101. }
  102. onclick = () => {
  103. update(1);
  104. previousLine = cursorCoords;
  105. typingStreak = 0;
  106. }
  107. setInterval(() => {update(1)},100);
  108. w.setFlushInterval(1);
  109. updateText();
  110. writeChar = () => {}
  111. setInterval(() => {
  112. if (typingStreak > 50) {
  113. positionX+=(-(cursorCoords[0]+cursorCoords[2]/tileC)*tileW-positionX)/2;
  114. positionY+=(-(cursorCoords[1]+cursorCoords[3]/tileR)*tileH-positionY)/2;
  115. w.render();
  116. }
  117. },30);
Add Comment
Please, Sign In to add comment