BillyTV Agent

Handles your auditions for you (mostly)

  1. // ==UserScript==
  2. // @name BillyTV Agent
  3. // @namespace BvS-ZeConster
  4. // @description Handles your auditions for you (mostly)
  5. // @version 1.4
  6. // @history 1.4 New domain - animecubedgaming.com - Channel28
  7. // @history 1.3 Now https compatible (Updated by Channel28)
  8. // @history 1.2 Should now be compatible with all versions of FireFox (Updated by Channel28, thanks to Terrec for adjusting the code)
  9. // @history 1.1 Added grant permissions (Updated by Channel28)
  10. // @history 1.0 Initial Release
  11. // @include http*://*animecubed.com/billy/bvs/billytv.html
  12. // @include http*://*animecubedgaming.com/billy/bvs/billytv.html
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_deleteValue
  16. // ==/UserScript==
  17.  
  18. //3 possible states:
  19. //1: haven't picked abilities yet
  20. //2: abilities picked, need to do challenges 2a: just did a challenge, need to pick another
  21. //3: doing a challenge
  22.  
  23. var playername = "";
  24.  
  25. try {
  26. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported") > -1)) {
  27. this.GM_getValue = function(key, def) {
  28. return localStorage[key] || def;
  29. };
  30. this.GM_setValue = function(key, value) {
  31. return localStorage[key] = value;
  32. };
  33. this.GM_deleteValue = function(key) {
  34. return delete localStorage[key];
  35. };
  36. }
  37. } catch (e) {}
  38.  
  39. loadPlayerName();
  40.  
  41. function loadPlayerName() {
  42. try {
  43. var temp = document.getElementsByName("player")[0];
  44. if ((temp == null) || (temp.localName.toLowerCase() == "text") || (temp.value.length == 0))
  45. return;
  46. playername = temp.value;
  47. } catch(e) {
  48. alert("Exception!\n\nError name: " + e.name + "\nError message: " + e.message);
  49. }
  50. }
  51.  
  52. if (document.body.innerHTML.indexOf("You still have") > -1) {
  53.  
  54. // Create the text area object
  55. var area = document.createElement("textarea");
  56. area.id = 'SchedulePlanningArea';
  57. area.rows = 11;
  58. area.cols = 20;
  59. // Create the button to fill the settings
  60. var a = document.createElement("a");
  61. a.href = "javascript:void(0)";
  62. a.innerHTML = "Click here to plan settings";
  63.  
  64. a.addEventListener("click", function() {
  65. var storethis = document.getElementById('SchedulePlanningArea').value;
  66. var challengeArr = storethis.split('\n');
  67. if (challengeArr.length < 11) {
  68. document.getElementById('SchedulePlanningArea').value = "Please try again.";
  69. return;
  70. }
  71. try {
  72. var challenges = [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11]];
  73. for (var i=0; i<11; i++) {
  74. challenges[i] = challengeArr[i].split(',');
  75. if (challenges[i].length != 9) {
  76. document.getElementById('SchedulePlanningArea').value = "Please try again.";
  77. return;
  78. }
  79. }
  80. var abilitiesused = [0,0,0,0,0,0,0,0];
  81. for (var i = 0; i < 8; i++) {
  82. for (var j = 0; j < 11; j++) {
  83. abilitiesused[i] += parseInt(challenges[j][i+1]);
  84. }
  85. }
  86. var match = /<b>Amount Left: ([\d,]+)\/([\d,]+)<\/b>/.exec ( document.body.innerHTML );
  87. match[2] = match[2].replace(",","");
  88. var totalawesome = parseInt(match[2]);
  89. var usedawesome = 0;
  90. usedawesome += abilitiesused[0]*4; usedawesome += abilitiesused[1]*6;
  91. usedawesome += abilitiesused[2]*8; usedawesome += abilitiesused[3]*10;
  92. usedawesome += abilitiesused[4]*12; usedawesome += abilitiesused[5]*20;
  93. usedawesome += abilitiesused[6]*30; usedawesome += abilitiesused[7]*100;
  94. var remainingawesome = totalawesome - usedawesome;
  95. if (remainingawesome < 0) {
  96. alert("Strategy uses "+usedawesome+" Awesome, but you only have "+totalawesome+" Awesome!");
  97. } else {
  98. if (remainingawesome >= 4) {
  99. if (remainingawesome%4 > 1) {
  100. abilitiesused[1] += 1;
  101. remainingawesome -= 6;
  102. }
  103. remainingawesome -= remainingawesome%4;
  104. abilitiesused[0] += remainingawesome/4;
  105. }
  106. document.evaluate("//input[@name = 'dice4']",document, null,
  107. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[0];
  108. document.evaluate("//input[@name = 'dice6']",document, null,
  109. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[1];
  110. document.evaluate("//input[@name = 'dice8']",document, null,
  111. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[2];
  112. document.evaluate("//input[@name = 'dice10']",document, null,
  113. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[3];
  114. document.evaluate("//input[@name = 'dice12']",document, null,
  115. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[4];
  116. document.evaluate("//input[@name = 'dice20']",document, null,
  117. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[5];
  118. document.evaluate("//input[@name = 'dice30']",document, null,
  119. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[6];
  120. document.evaluate("//input[@name = 'dice100']",document, null,
  121. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = abilitiesused[7];
  122. GM_setValue(playername+"_challenges",storethis);
  123. var planning = GM_getValue(playername+"_challenges","");
  124. }
  125. } catch (err) {
  126. alert('An error has occured:\n\n' + err.message);
  127. }
  128. },false);
  129.  
  130. // Finally, HTML div overlay
  131. var div = document.createElement("div");
  132. div.style.left = "40px";
  133. div.style.top = "100px";
  134. div.style.position = "fixed";
  135. div.style.width = "195px";
  136. div.style.height = "290px";
  137. div.style.background = 'none repeat scroll 0% 0% rgb(216, 100, 100)';
  138. // Add the text area
  139. div.innerHTML = "<br>1. Paste the settings string here:<br>"
  140. div.appendChild(area);
  141. div.innerHTML += "<br><br>2. ";
  142. div.appendChild(a);
  143.  
  144. document.body.appendChild(div);
  145.  
  146. } else if ((document.body.innerHTML.indexOf("Choose a Challenge Below!") > -1)
  147. || (document.body.innerHTML.indexOf(":: Attempt") > -1)) {
  148. var planning = GM_getValue(playername+"_challenges","");
  149. var challengeArr = planning.split('\n');
  150. var challenges = [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11]];
  151. for (var i=0; i<11; i++) {
  152. challenges[i] = challengeArr[i].split(',');
  153. }
  154. //now figure out which challenge we're on
  155. for (var i = 0; i < 11; i++) {
  156. var currentindex = challenges[i][0];
  157. var str = "//input [@id='chl" + currentindex + "']";
  158. var element = document.evaluate(str,document, null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  159. if ((element.snapshotLength > 0) && (element.snapshotItem(0).disabled == false)) {
  160. i = 11; //we're done
  161. element.snapshotItem(0).checked = true;
  162. }
  163. }
  164. } else if (document.body.innerHTML.indexOf("Attempting:") > -1) {
  165. var planning = GM_getValue(playername+"_challenges","");
  166. var challengeArr = planning.split('\n');
  167. var challenges = [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11]];
  168. for (var i=0; i<11; i++) {
  169. challenges[i] = challengeArr[i].split(',');
  170. }
  171. //now figure out which challenge we're on
  172. for (var i = 0; i < 11; i++) {
  173. var currentindex = challenges[i][0];
  174. var str = "//input [@id='chl" + currentindex + "']";
  175. var element = document.evaluate(str,document, null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  176. if ((element.snapshotLength > 0) && (element.snapshotItem(0).disabled == false)) {
  177. var thischallenge = challengeArr[i].split(',');
  178. document.evaluate("//input[@name = 'dieused4']",document, null,
  179. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[1];
  180. document.evaluate("//input[@name = 'dieused6']",document, null,
  181. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[2];
  182. document.evaluate("//input[@name = 'dieused8']",document, null,
  183. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[3];
  184. document.evaluate("//input[@name = 'dieused10']",document, null,
  185. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[4];
  186. document.evaluate("//input[@name = 'dieused12']",document, null,
  187. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[5];
  188. document.evaluate("//input[@name = 'dieused20']",document, null,
  189. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[6];
  190. document.evaluate("//input[@name = 'dieused30']",document, null,
  191. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[7];
  192. document.evaluate("//input[@name = 'dieused100']",document, null,
  193. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).value = thischallenge[8];
  194. document.evaluate("//input [@name='actattemptit']",document,null,
  195. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).checked = true;
  196. i = 11; //we're done
  197. }
  198. }
  199. }

QingJ © 2025

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