Autostrife

Automatically strifes on the Overseer project.

  1. // ==UserScript==
  2. // @name Autostrife
  3. // @namespace http://gigapause.com/
  4. // @version 1.1
  5. // @description Automatically strifes on the Overseer project.
  6. // @author capableResistor
  7. // @grant none
  8. // @match http://*.theoverseerproject.com/*
  9. // @match http://92.222.26.236/*
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
  11. // @require https://gf.qytechs.cn/scripts/5995-overseer-enhanced/code/Overseer%20Enhanced.js?version=22511
  12. // ==/UserScript==
  13.  
  14. function strife(){
  15. var pathArray = window.location.pathname.split( '/' );
  16. var pathLength = pathArray.length -1;
  17. var currPath = pathArray[pathLength];
  18. createInput();
  19. if(currPath == "dreamtransition.php") {
  20. printcon("Switching dreamstates, cookie cleansed.");
  21. unsetCookie('autostrife');
  22. }
  23. if($('#aspect').length){
  24. var healthcontainer = $('#banner > div.intercross > span > div.pined');
  25. var encountercontainer = $('#banner > div.intercross > div.lefy > span');
  26. var health = healthcontainer.html();
  27. var encounters = encountercontainer.html();
  28. health = health.replace( /^\D+/g, '');
  29. health = health.replace('%','');
  30. encounters = encounters.replace( /^\D+/g, '');
  31. document.title = "H: " + Number(health) + "%" + " E: " + Number(encounters) + ". Overseer";
  32. if (getCookie('autostrife') == "") {
  33. printcon("Autostrife cookie not set. Not autostrifing.");
  34. } else if (getCookie('autostrife') == "doStrife") {
  35. if(Number(health) < 20 ) {
  36. //abscond();
  37. printcon("Too dangerous to autostrife (Health below 20%). Manual intervention required.");
  38. } else {
  39. setTimeout(attack, 3000);
  40. }
  41. }
  42. } else if ($('#canner a').length > 0 && $.trim($('#canner a').text()) == "Strife again" && getCookie('autostrife') == "doStrife") {
  43. printcon("Strife concluded.");
  44. unsetCookie('autostrife');
  45. } else {
  46. printcon("Idle.");
  47. }
  48. }
  49.  
  50. function setCookie(cname, cvalue, exdays){
  51. var d = new Date();
  52. d.setTime(d.getTime() + (exdays*24*60*60*1000));
  53. var expires = "expires="+d.toUTCString();
  54. document.cookie = cname + "=" + cvalue + "; " + expires;
  55. }
  56.  
  57. function unsetCookie(cname){
  58. document.cookie = cname + "=; expires=-90019001";
  59. }
  60.  
  61. function getCookie(cname){
  62. var name = cname + "=";
  63. var ca = document.cookie.split(';');
  64. for(var i=0; i<ca.length; i++) {
  65. var c = ca[i];
  66. while (c.charAt(0)==' ') c = c.substring(1);
  67. if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
  68. }
  69. return "";
  70. }
  71.  
  72. function createInput(){
  73. var atbutton = $('input[type="submit"][value="Abscond"]');
  74. var userinfo = $('#banner > div.intercross > span > div.lined > a');
  75. var mainbox = $('#banner');
  76. var buttonbox = $('#strifebuttons');
  77. if (mainbox.length > 0){
  78. if ($('#stop').length > 0){
  79. printcon("Stop button already exists. Not creating.");
  80. } else {
  81. buttonbox.append($('<span class="rhyme slam astop" id="stop">STOPAUTO</span>'));
  82. buttonbox.append($('<style>#stop {\ncolor: #000;\nmargin-left: 5px;\nmargin-right: 10px;\nmargin-top: 5px;\n}\n#stop:active {\nbackground-color: #444;\ncolor: #FFF;\n}\n#stop:hover {\noutline: thin red solid\n}\n</style>'));
  83. document.getElementById('stop').addEventListener("click", stop, false);
  84. }
  85. }
  86. if(atbutton.length > 0){
  87. var buttonbox = $('#strifebuttons');
  88. buttonbox.append($('<span class="rhyme slam aautos" id="astrife">AUTOSTRIFE</span>'));
  89. buttonbox.append($('<style>#astrife {\ncolor: #000;\nmargin-left: auto;\nmargin-right: 10px;\nmargin-top: 5px;\n}\n#astrife:active {\nbackground-color: #444;\ncolor: #FFF;\n}\n#astrife:hover {\noutline: thin red solid\n}\n</style>'));
  90. document.getElementById('astrife').addEventListener("click", autoStrife, false);
  91. }
  92. }
  93.  
  94. function attack(){
  95. printcon("Attacking.");
  96. var atbutton = $('input[type="submit"][value="Attack"]');
  97. atbutton.trigger("click");
  98. }
  99.  
  100. function abscond(){
  101. printcon("Absconding.");
  102. var abbutton = $('input[type="submit"][value="Abscond"]');
  103. abbutton.trigger("click");
  104. }
  105.  
  106. function initiate(){
  107. printcon("Initiating strife.");
  108. var lastbutton = $('input[type="submit"][value="Fight these enemies again!"]');
  109. lastbutton.trigger("click");
  110. }
  111.  
  112. function autoStrife(){
  113. printcon("Autostrifing.");
  114. setCookie('autostrife', 'doStrife', '1');
  115. window.location.href = 'strife.php';
  116. }
  117.  
  118. function stop(){
  119. if (getCookie('autostrife') === ""){
  120. printcon("Cookie isn't even set. No need to keep pressing this.");
  121. } else {
  122. printcon("Unsetting autostrife cookie.");
  123. unsetCookie('autostrife');
  124. }
  125. }
  126.  
  127. function printcon(data){
  128. var mainconsole = $('#strifeconsole');
  129. mainconsole.append($('<div style="color: #FFF; background-color: rgba(0,0,0,.20);">[AUTOSTRIFE]====> ' + data + '</div>'));
  130. mainconsole.scrollTop(($('#strifeconsole').height()*2));
  131. }
  132.  
  133. strife();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址