auto respawn

autorespawn, toggle with 't'

  1. // ==UserScript==
  2. // @name auto respawn
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description autorespawn, toggle with 't'
  6. // @author You
  7. // @match https://takepoint.io/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. window.addEventListener("keydown", toggleRespawn);
  15.  
  16. var foot = document.getElementById("footers");
  17. var respawn = true;
  18. var overlay = document.getElementsByClassName("featured-game-container")[0];
  19. overlay.style = "pointer-events: none; position: fixed; top:10px; left:10px; font-family: 'Comic Sans MS', cursive, sans-serif; color: #FFFFFF; font-style: normal; font-variant: normal; z-index: 9999;";
  20. let stats = [];
  21.  
  22.  
  23. var observer = new MutationObserver(function(mutations){
  24. mutations.forEach(function(mutation){
  25. if(mutation.type == "attributes"){
  26. if(document.getElementById("footers").style.display == "flex"){
  27. addScript();
  28. }
  29. }
  30. });
  31. });
  32. observer.observe(foot, {
  33. attributes: true //configure it to listen to attribute changes
  34. });
  35.  
  36. function toggleRespawn(e){
  37. if(e.keyCode == 84){
  38. respawn = !respawn;
  39. console.log(respawn);
  40. overlay.innerHTML = respawn ? "<h3>respawn: true (press t to change)</h3>" : "<h3>respawn: false (press t to change)</h3>";
  41. }
  42. }
  43. // Your code here...
  44.  
  45. function addScript(){
  46. let width = renderArea.canvasWidth;
  47. let height = renderArea.canvasHeight;
  48. let centerX = width/2;
  49. let centerY = height/2;
  50. ASM_CONSTS[7315] = function($0, $1, $2, $3) {
  51. let text = UTF8ToString($1);
  52. contexts[$0].strokeText(text, $2, $3);
  53. let positionX = $2 < centerX + 200 && $2 > centerX - 200;
  54. let positionY = $3 < centerY - 200;
  55. if($0 == 1 && positionX && positionY && !(stats.includes(text))){
  56. stats.push(text);
  57. }
  58. if(stats.length > 7){
  59. console.log(stats);
  60. if(respawn == true){
  61. eg(); //play function
  62. }
  63. resetScript();
  64. }
  65.  
  66. };
  67. }
  68. function resetScript(){
  69. stats = [];
  70. ASM_CONSTS[7315] = function($0, $1, $2, $3) {
  71. contexts[$0].strokeText(UTF8ToString($1), $2, $3);
  72. };
  73. }
  74.  
  75.  
  76. })();