BvS Quest Hotkeys

Quest hotkeys for BvS

  1. // ==UserScript==
  2. // @name BvS Quest Hotkeys
  3. // @namespace BvS
  4. // @description Quest hotkeys for BvS
  5. // @version 4
  6. // @history 4 clicking d also starts the quest "forest of death"
  7. // @history 3 clicking d also starts the quests "Very Tragic Story", "Stalkergirl", "Checkmate", "junk II", "junk III", "junk IV"
  8. // @history 2 added claiming your snow rewards, streamlined code, clicking c when out of stamina should no longer reload page
  9. // @history 1.7 fixed watching your show (watching your shows is now quest44 not quest43)
  10. // @history 1.6 button press will start "watching your shows" if available.
  11. // @history 1.5 on rolling quests, will reattempt with same jutsu choice if available.
  12. // @history 1.4 will not reload page if out of stamina
  13. // @history 1.3 solved problem where clicking d on the quest main page reloaded it. More efficient code. press d to start and skip chunin exam.
  14. // @history 1.2 script termination to prevent performance degredation, and to prevent accidental reloading of quests page mid quest (if clicking d too fast).
  15. // @history 1.1 Added updateURL
  16. // @history 1.0 Initial version
  17. // @match http://www.animecubed.com/billy/bvs/quest*
  18. // @match http://animecubed.com/billy/bvs/quest*
  19. // @match http://www.animecubed.com/billy/bvs/chuninexam*
  20. // @match http://animecubed.com/billy/bvs/chuninexam*
  21. // ==/UserScript==
  22.  
  23. function submit_form(form_name)
  24. {
  25. if (document.forms.namedItem(form_name))
  26. {
  27. remove_listener(); //Remove keypress listener before page refresh
  28. location.assign('javascript:' + form_name + '.submit()');
  29. }
  30. }
  31.  
  32. function remove_listener()
  33. {
  34. window.removeEventListener("keyup", key_press, false); // Removes the event listener, this is critically important to prevent "playing too fast" errors when spamming the button.
  35. }
  36.  
  37. function key_press(event)
  38. {
  39. if (event.keyCode==68) //keypress d
  40. {
  41. if(0<=document.body.textContent.search("Not Enough Stamina")) //Check for out of stamina, to avoid reloading on quest fail. Must come before checking for "attack", since out of stamina hide from user but does not disable attack key.
  42. {
  43. remove_listener(); //Remove key listener
  44. }
  45. else if(document.forms.namedItem("goquest2")) //Check for quest fail, to avoid reloading on quest fail
  46. {
  47. remove_listener(); //Remove key listener
  48. }
  49. else if(document.forms.namedItem("attack")) //checks for a button named "Attack"
  50. {
  51. submit_form("attack");
  52. }
  53. else if(document.forms.namedItem("goquestgo")) //Check for reattempt rolling quest with same jutsu
  54. {
  55. submit_form("goquestgo");
  56. }
  57. else if(document.forms.namedItem("goquest")) //Check for going to next step in quest is available.
  58. {
  59. submit_form("goquest");
  60. }
  61. else if(document.forms.namedItem("questcontinue")) //Check for Continue Quest (when you left the quest menu and came back)
  62. {
  63. submit_form("questcontinue");
  64. }
  65. else if(document.forms.namedItem("quest44")) //Check if the "Watching your shows" quest is available.
  66. {
  67. submit_form("quest44"); //Start Daily shows quest
  68. }
  69. else if(document.forms.namedItem("questchu1")) //Check if the chunin exam is available.
  70. {
  71. submit_form("questchu1"); //Start Chunin Exam quest
  72. }
  73. else if(document.forms.namedItem("skipchu")) //Check for skip chunin exam button
  74. {
  75. submit_form("skipchu"); //Skip Chunin Exam
  76. }
  77. else if(document.forms.namedItem("quest85")) //Check for "forest of death"
  78. {
  79. submit_form("quest85");
  80. }
  81. else if(document.forms.namedItem("quest17")) //Check for "World Shoveling Association" to collect snow winning
  82. {
  83. submit_form("quest17"); //start "World Shoveling Association" quest
  84. }
  85. else if(document.forms.namedItem("quest125")) //Check for "Very Tragic Story" quest
  86. {
  87. submit_form("quest125");
  88. }
  89. else if(document.forms.namedItem("quest159")) //Check for "Stalkergirl" quest
  90. {
  91. submit_form("quest159");
  92. }
  93. else if(document.forms.namedItem("quest165")) //Check for "Checkmate" quest
  94. {
  95. submit_form("quest165");
  96. }
  97. else if(document.forms.namedItem("quest94")) //Check for "Junk II" quest
  98. {
  99. submit_form("quest94");
  100. }
  101. else if(document.forms.namedItem("quest145")) //Check for "Junk III" quest
  102. {
  103. submit_form("quest145");
  104. }
  105. else if(document.forms.namedItem("quest87")) //Check for "Junk IV" quest
  106. {
  107. submit_form("quest87");
  108. }
  109. else if(document.forms.namedItem("questhide")) //Check for the quest hide interface to indicate that the current page is the main quest window, to prevent reloading it
  110. {
  111. remove_listener(); //Remove key listener
  112. }
  113. else
  114. {
  115. remove_listener(); //Remove key listener
  116. submit_form("minim4"); //Return to Quests menu if quest completed
  117. }
  118. }
  119. else if (event.keyCode==67) //keypress c
  120. {
  121. submit_form("chakra"); //Charge chakra
  122. }
  123. }
  124.  
  125. window.addEventListener("keyup", key_press, false);