Trophy Room Enhancer

Highlights, rearranges, and adds context to Trophy Room stuff

  1. // ==UserScript==
  2. // @name Trophy Room Enhancer
  3. // @namespace FaxCelestis
  4. // @description Highlights, rearranges, and adds context to Trophy Room stuff
  5. // @include *animecubed.com/billy/bvs/trophyroom.h*
  6. // @include *animecubedgaming.com/billy/bvs/trophyroom.h*
  7. // @grant GM_addStyle
  8. // @author FaxCelestis and Terrec and Channel28
  9. // @version 1.9
  10. // 0.1 - possibly does things
  11. // 0.2 - does those things better
  12. // 1.0 - compvare rewrite by Terrec
  13. // 1.1 - minor edits, addition of Syntherum
  14. // 1.2 - bugfix
  15. // 1.3 - added new trophies (WotAdventure EX and Acedia) by Channel28
  16. // 1.4 - forgot to add One Twenty One - by Channel28
  17. // 1.5 - new trophy (In Kaiju It Means Love) by Channel28
  18. // 1.6 - new trophy (Superbia) by Channel28
  19. // 1.7 - New domain - animecubedgaming.com - Channel28
  20. // 1.8 - new trophy (Spirit of Ninja-Mas) by Channel28
  21. // 1.9 - new trophies (HelperCats One & Two) by Channel28
  22.  
  23. // ==/UserScript==
  24. // force strict mode for Chrome functionality
  25. "use strict";
  26.  
  27. // get player and password hash from html, unnecessary for anything this script uses ATM but still good to have
  28. var player = document.getElementsByName("player")[1].value;
  29. var pass = document.getElementsByName("pwd")[1].value;
  30.  
  31. // ["Trophy Name", Points, "Trophy Description" [, Gallery Number]]
  32. var trophyList = [
  33. ["A-gah-gah-gah", 1, "Recover from negative HP via Veggies", 4],
  34. ["Adelheid", 1, "Get a yakuman without cheating", 6],
  35. ["Alone at Last", 1, "Take 1 Ally into the Tunnel", 12],
  36. ["Big Fudge", 1, "Get the Max Score in a Tsukiball game", 3],
  37. ["Bluff Boss", 1, "Showdown with High Card and have the opponent fold", 28],
  38. ["Board Breaker", 1, "Get a Triple Bullseye with a regular Kunai", 34],
  39. ["Both Shoulders", 1, "Spin the wheel with both Billy and The Rack", 31],
  40. ["Buggin", 1, "Hang out with Bugman Lvl. 2 via MPB", 70],
  41. ["Call it a Comeback", 1, "Defeat a Titan with 10 or less HP remaining", 49],
  42. ["Checking It Twice", 1, "Visit the Trophy Room with both Maximum Naughtiness and Niceness awards at once", 21],
  43. ["Clipper", 1, "Use a Daily Fail coupon to buy 1 Kunai and get 1 free", 22],
  44. ["Completionist 11", 1, "Have 50+ 1-Point Trophies on the Trophy Page", 40],
  45. ["Completionist II", 1, "Have 20+ 1-Point Trophies on the Trophy Page", 53],
  46. ["Completionist III", 1, "Have 30+ 1-Point Trophies on the Trophy Page", 45],
  47. ["Consolation Prize", 1, "Win 500,000 Ryo in a game of SNAKEMAN or No SNAKEMAN", 46],
  48. ["Conssssolation", 1, "Take the deal with SNAKEMAN in your bucket", 20],
  49. ["Counting Carbs", 1, "Drink Diet Soda with 0 Greass", 24],
  50. ["Dark Victor", 1, "Win an Arena Fight during the Dark Hour", 33],
  51. ["Dead Man Walking", 1, "Defeat 100 Zombjas in one map without an equipped weapon", 42],
  52. ["Dressed to Kill", 1, "Start a con with 11 complete cosplay costumes", 64],
  53. ["Einhorn is Finkle", 1, "Get 11 Pets", 56],
  54. ["Enough Already", 1, "Loop to Season 111", 36],
  55. ["Everybody Out", 1, "Checkout 6+ customers at once", 48],
  56. ["Fired on Friday", 1, "Rage out with 1 Time remaining", 58],
  57. ["First?", 1, "Get 1st Place in First Loser", 29],
  58. ["Flushed", 1, "Discard an entire Royal Flush at once", 43],
  59. ["Forever Alone", 1, "Go in the Tunnel alone", 30],
  60. ["Four Day Weekend", 1, "Vacation Thursday, Friday, Saturday, and Sunday", 13],
  61. ["Four Seasons", 1, "Get 50 or more points in one Flower Wars hand", 47],
  62. ["Gallery II", 20, "Complete the second Snooty Gallery artwork"],
  63. ["Gone", 1, "Finish a Crazy Hard ride within 60 seconds", 55],
  64. ["Handoff", 1, "Have A A Ron check out your last customer", 68],
  65. ["Hard Worker", 1, "Do 11 S-Rank Missions in one day", 60],
  66. ["Hero's Reward", 1, "Turn in 1 S-Rank Emblem successfully", 67],
  67. ["High Summoner", 1, "Summon 11 summons in a day", 38],
  68. ["I Miss You Already", 1, "Change your Team to the same Team you just had", 25],
  69. ["In Phase", 1, "Defeat 2 Phases in one day", 69],
  70. ["Indecisive Reaper", 1, "Change to all four Reaper States in one day", 17],
  71. ["Independent Contractor", 1, "Sell a Village Contract", 27],
  72. ["Just a Piece", 1, "Share Delicious Cake", 35],
  73. ["Killed to Dress", 1,"Start a con with 111 complete cosplay costumes", 37],
  74. ["KTHXBAIman", 1, "Bust out a Mahjong opponent with a Baiman", 62],
  75. ["Legen..dary", 1, "111+ Successes on a Crank 11 S-Rank Mission", 63],
  76. ["Long Day Ahead", 1, "Consume something that brings you to 11,000+ Stamina", 66],
  77. ["Low Roller", 1, "Get 6+ Pachinko Comps in one turn-in", 2],
  78. ["Lucre Libre", 1, "Throw a Lucha Fight", 41],
  79. ["Many Hands", 1, "Fully load the truck with zero injury", 26],
  80. ["Meddling Kids", 1, "Beat an S-Rank Mission with Lvl 3. Billy, Pinky, and Stalkergirl", 16],
  81. ["Mercenary", 1, "Turn in 111+ contracts at once", 19],
  82. ["Movin' On Up", 1, "45+ Lvl. 2 or greater Allies on the Team Page", 14],
  83. ["One Man Army", 1,"Win 111 arena matches in one day", 54],
  84. ["Palate Cleanser", 1, "Drink 12 or more different Juice Types at once", 32],
  85. ["Popular", 1, "Visit your Team Page while hanging out with 11+ Allies", 5],
  86. ["Psychological Issues", 1, "Trapdoor your future self", 52],
  87. ["Rave Grandmaster", 1, "Get 11,000+ in the Rave", 59],
  88. ["Sacred Hang", 1, "Visit your special Field", 10],
  89. ["Self Five", 1, "Attempt to Walk Together with yourself", 39],
  90. ["Showoff", 1, "Visit the Party House with over 11,000,000 Ranking XP", 11],
  91. ["Stupid Devil Machines", 1, "Kick the Crane Machine with your last 2 Stamina", 7],
  92. ["Super Failure", 1, "SuperFail on Attempt 2", 18],
  93. ["Surefire Strategy", 1, "Have a bet on all possible spins in Roulette", 23],
  94. ["That Was Easy", 1, "Say 'Trophy' in Hidden Forbidden Holy Ground", 51],
  95. ["The Most Dangerous Strut", 1, "Escape the Squee during a four hour hunt", 50],
  96. ["The Pizza Is Not Enough", 1, "Successfully create an Ultimate Pizza", 65],
  97. ["Tsk-Ts.. Oh.", 1, "Have a clean store when a Tsk-Tsk Tsks", 61],
  98. ["Two Weeks Notice", 1, "Take a Vacation with 14+ days on the timer", 15],
  99. ["Universal Acclaim", 1, "Have 99+ Allies on the Team page", 44],
  100. ["Value Meal", 1, "Eat 4 different Greassy Items in a row", 9],
  101. ["Vwom", 1, "Attack with an 11Saber", 8],
  102. ["Work Angry", 1, "Clear all customers with 200+ Rage", 57],
  103. ["HelperCats One", 5, "Get the first row of HelperCats"],
  104. ["HelperCats Two", 5, "Get the second row of HelperCats"],
  105. ["S-1", 5, "Get the Season One Collection"],
  106. ["S-2", 5, "Get the Season Two Collection"],
  107. ["S-3", 5, "Get the Season Three Collection"],
  108. ["S-4", 5, "Get the Season Four Collection"],
  109. ["S-5", 5, "Get the Season Five Collection"],
  110. ["Acedia", 10, "Complete RG Day One"],
  111. ["Baton Pass", 10, "Get the Red Skull Pin"],
  112. ["Brothers in Arms", 10, "Beat Difficulty 11 in Infinite Retail"],
  113. ["EGOT", 10, "Win all roles in BillyTV at least once"],
  114. ["Employee of the Week", 10, "Bought in the Black Friday Shop"],
  115. ["Fruit Dealer", 10, "Eat Fresh Fruit with 50+ Cool"],
  116. ["Fully Cranked", 10, "Defeat a Mission at Maximum Crank"],
  117. ["Gallery I", 10, "Complete the first Snooty Gallery Artwork"],
  118. ["Gift Giver", 10, "Gave a Sho Nuff Elixir / Over 11000 for Hidden HoClaus"],
  119. ["Huzzah", 10, "Save Mimi"],
  120. ["In Kaiju It Means Love", 10, "Have 11 different tattoo touchup additions at once"],
  121. ["Land a Whale", 10, "Check out a Whale in Retail"],
  122. ["Quantum Loop", 10, "Get Bugman Lvl. 2"],
  123. ["Smile For The Camera", 10, "Got a Bromide on Candyween"],
  124. ["Spirit of Ninja-Mas", 10, "Complete the Twelve Days of Ninja-Mas 2"],
  125. ["Superbia", 10, "Complete RG Day Two"],
  126. ["The Unthinkable", 10, "I can't even bring myself to explain."],
  127. ["WotAdventure EX", 10, "Defeat a WotAdventure witth Difficulty 1 or greater"],
  128. ["In One Piece", 11, "Drink Syntherum"],
  129. ["If I Could Turn Back Time", 20, "Get the Pocketwatch working again"],
  130. ["Okkusenman", 20, "Achieve a Rank of S against a WorldKaiju"],
  131. ["One Twenty One", 20, "Level A Leven to Power 11"],
  132. ["Pierce The Heavens", 20, "Arrive in the AboveGround"],
  133. ["Rising Sun", 20, "Defeat Triple H in Mahjong"],
  134. ["Scrapbook Hero", 20, "Got all Six Bromides"],
  135. ["TACOCAT", 20, "Defeat the OCAT"],
  136. ["The Festival", 20, "Defeated the Eleven Tails at The Festival"],
  137. ["The Sky Will Strike", 20, "Achieve Protagonist Rank"],
  138. ["Tiny Three", 20, "Bank 3+ different Tiny Bee Weapons"],
  139. ["Choosing Sides", 60, "Gain the Fate or Destiny Bloodline"]
  140. ];
  141.  
  142. var trophydiv = document.getElementById('trophydiv');
  143. var trophyTable = trophydiv.firstElementChild;
  144.  
  145. while(trophyTable.rows[trophyTable.rows.length-1].innerHTML.indexOf('0x.jpg') > -1){
  146. var tr = trophyTable.rows[trophyTable.rows.length-1];
  147. var td = tr.cells[1];
  148. var name = td.children[0].textContent;
  149. var points = td.children[1].firstElementChild.textContent;
  150. var desc = td.children[2].nextSibling.textContent.substr(1);
  151. trophyList.push([name,points,desc]);
  152. trophyTable.deleteRow(-1);
  153. trophyTable.deleteRow(-1);
  154. }
  155.  
  156. //Make sure the array is sorted
  157. trophyList.sort(function(a, b) {
  158. if(a[1] === b[1]){
  159. if(a[0].toLowerCase() > b[0].toLowerCase()){
  160. return 1;
  161. }
  162. if(a[0].toLowerCase() < b[0].toLowerCase()){
  163. return -1;
  164. }
  165. return 0;
  166. }
  167. return a[1] - b[1];
  168. });
  169.  
  170. //Returns the number of 1 Point Trophies earned
  171. var singlePointers = (trophydiv.innerHTML.match(/<font color="00A100">1<\/font>/gm) || []).length;
  172.  
  173. //Grabs current Awesome and calculates maxAwesome
  174. var curAwesome = parseInt(/Awesome Awarded: (\d+)/.exec(document.body.textContent)[1],10);
  175. var maxAwesome = curAwesome;
  176. var TheEleven = /Bonus for \d+ The Eleven\: \+(\d+) Awesome!/.exec(document.body.textContent);
  177. if(TheEleven) {
  178. maxAwesome -= parseInt(TheEleven[1],10);
  179. }
  180.  
  181. var expand = trophydiv.previousElementSibling.cloneNode(true);
  182. expand.innerHTML = expand.innerHTML.replace("Trophy List","Missing Trophies");
  183. expand.innerHTML = expand.innerHTML.replace("trophydiv","missingdiv");
  184. var missingdiv = trophydiv.cloneNode(false);
  185. missingdiv.id = "missingdiv";
  186. var table = missingdiv.appendChild(trophydiv.firstElementChild.cloneNode(false));
  187.  
  188. for(var i of trophyList){
  189. if(trophydiv.innerHTML.indexOf('<b>' + i[0] + '</b>') === -1){
  190. //Give Completionist I its gallery number
  191. if(i[0] === "Completionist I")
  192. i.push(1);
  193. var temp = "";
  194. temp += "<td width=80><img src=\"/billy/layout/trophies/0x.jpg\"></td><td style=\"color:000000\"><i><b>";
  195. temp += i[0];
  196. temp += "</b></i> : <b><font color=00A100>";
  197. temp += i[1];
  198. temp += "</font> Point";
  199. if(i[1] !== 1)
  200. temp += "s";
  201. temp += "</b><br>";
  202. temp += i[2];
  203. if(i[3]){
  204. if(!document.forms.namedItem("showart")){
  205. var span = document.evaluate("(//span[img[contains(@src,'artblock"+i[3]+"')]])", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  206. if(span){
  207. if(span.title){
  208. span.title = span.title.replace("???",i[0]);
  209. span.title = span.title.replace("???",i[2]);
  210. }
  211. if(span.boHDR){
  212. span.boHDR = span.boHDR.replace("???",i[0]);
  213. }
  214. if(span.boBDY){
  215. span.boBDY = span.boBDY.replace("???",i[2]);
  216. }
  217. }
  218. }
  219. temp += " (Gallery #" + i[3] + ")";
  220. }
  221. temp += "</td>";
  222. table.insertRow(-1).innerHTML = temp;
  223. table.insertRow(-1).innerHTML = "<td colspan=2 align=center><img src=\"/billy/layout/missionbar/blackbar.gif\" width=460 height=1></td>"
  224. maxAwesome += i[1];
  225. }
  226. }
  227. table.deleteRow(-1);
  228.  
  229. //Insert the missing trophies table
  230. var font = document.evaluate("(//font[contains(.,'Awesome Abilities')])[last()]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  231. font.parentNode.insertBefore(expand,font);
  232. font.parentNode.insertBefore(missingdiv,font);
  233. font.parentNode.insertBefore(document.createElement("hr"),font);