Tard's KoL Scripts - Strange Leaflet

Strange Leaflet spoiler script

目前为 2014-08-12 提交的版本,查看 最新版本

  1. // Tard's KoL Scripts
  2. // Copyright (c) 2006, Byung Kim
  3. // Released under the GPL license
  4. // http://www.gnu.org/copyleft/gpl.html
  5. //
  6. // ==UserScript==
  7. // @name Tard's KoL Scripts - Strange Leaflet
  8. // @namespace http://kol.dashida.com
  9. // @author Tard
  10. // @contributor Hellion
  11. // @include *kingdomofloathing.com/main_c.html
  12. // @include *kingdomofloathing.com/main.*
  13. // @include *kingdomofloathing.com/leaflet.*
  14. // @description Strange Leaflet spoiler script
  15. // @version 0.53
  16. // ==/UserScript==
  17.  
  18.  
  19. /********************************** Change Log **********************************************
  20. v0.53: fix infinite loop after bowling trophy acquisition.
  21. v0.52: add auto-clicking of the "Do It!" button, except when the secret code is in play.
  22.  
  23. ********************************************************************************************/
  24. if (window.location.pathname == "/main_c.html" || window.location.pathname == "/main.html" || window.location.pathname == "/main.php") {
  25.  
  26. // setTimeout('if (window["checkForUpdate"]) checkForUpdate("strangeleaflet","0.5","Strange Leaflet","http://kol.dashida.com/tardskolscripts_strangeleaflet.user.js");',1000);
  27. GM_setValue("newArea","false");
  28. GM_log("strange, leaflet.");
  29.  
  30. } else {
  31.  
  32. var body = document.getElementsByTagName('body')[0];
  33. var bodyHTML = body.innerHTML;
  34. var tds = document.getElementsByTagName('td');
  35. var td1 = tds[0].innerHTML.replace(/<.{0,1}b>/gi,"");
  36. var td3 = tds[2].innerHTML;
  37. var command = "";
  38. var code = "";
  39. var submit = true;
  40. // GM_log("td1="+td1);
  41. // GM_log("td3="+td3);
  42. if (GM_getValue("newArea") == "true") {
  43. switch(td1) {
  44. case "North of the Field":
  45. command = "south";
  46. break;
  47. case "West of House":
  48. if (td3.indexOf("You leave the house.") != -1) command = "south";
  49. else command = "east";
  50. break;
  51. case "In the House":
  52. if (td3.indexOf("parchment") != -1) command = "read parchment";
  53. else if (td3.indexOf("Bits of torn and wadded newspaper") != -1) command = "look fireplace";
  54. else if (td3.indexOf("An eerie glow surrounds you") != -1 || td3.indexOf("That only works once") != -1) command = "light fireplace";
  55. else if (td3.indexOf("large pair of boots") != -1 || td3.indexOf("At this point, it's not so much tinder as ash") != -1) command = "get boots";
  56. else if (td3.indexOf("Okay, got 'em") != -1 || td3.indexOf("You've already got the boots") != -1) command = "wear boots";
  57. else if (td3.indexOf("With some difficulty, you strap on the boots") != -1 || td3.indexOf("Since you're already wearing them") != -1) command = "west";
  58. else if (td3.indexOf("The fireplace is stacked with dry firewood and tinder, ready for lighting") != -1) {
  59. if (td3.indexOf("small white house") != -1) {
  60. code = "xyzzy";
  61. command = "light fireplace";
  62. } else if (td3.indexOf("brick building") != -1) {
  63. code = "plugh";
  64. command = "light fireplace";
  65. } else if (td3.indexOf("bird") != -1) {
  66. code = "plover";
  67. command = "light fireplace";
  68. } else if (td3.indexOf("ship") != -1) {
  69. code = "yoho";
  70. command = "light fireplace";
  71. } else if (td3.indexOf("trophy") != -1) {
  72. command = "take trophy";
  73. } else {
  74. command = "light fireplace";
  75. }
  76. if (code != "") {
  77. GM_setValue("code",code);
  78. body.innerHTML = '<div style="height:50px;"><a href="javascript:document.whatnow.command.value=\'' + code + '\';void(0);">Click here to reveal the secret code</a></div>' + bodyHTML;
  79. submit = false;
  80. }
  81. }
  82. else command = "look tinder";
  83. break;
  84.  
  85. case "South Bank":
  86. if (GM_getValue("code")) {
  87. body.innerHTML = '<div style="height:50px;">Warning: Proceeding further will eliminate your opportunity for using the secret code.'+
  88. '<br/><a href="javascript:document.whatnow.command.value=\'' + GM_getValue("code") +
  89. '\';void(0);">Click here to reveal the secret code</a></div>' + bodyHTML;
  90. submit = false;
  91. }
  92. command = "south";
  93. break;
  94. case "Forest":
  95. if (td3.indexOf("south") != -1) command = "south";
  96. else if (td3.indexOf("east") != -1) command = "east";
  97. else if (td3.indexOf("west") != -1) command = "west";
  98. else if (td3.indexOf("north") != -1) command = "north";
  99. break;
  100.  
  101. case "On the other side of the forest maze...":
  102. if (td3.indexOf("You carefully make your way back down to the forest floor") != -1) command = "look in leaves";
  103. else command = "up";
  104. break;
  105.  
  106. case "Halfway Up The Tree":
  107. if (td3.indexOf("large egg encrusted with precious jewels") != -1) command = "get egg";
  108. else if (td3.indexOf("manage to get the egg without losing your grip on the tree") != -1 || td3.indexOf("You've already got the egg") != -1) command = "throw egg roadrunner";
  109. else if (td3.indexOf("the ruby, which plummets past you") != -1 || td3.indexOf("You don't have a ruby") != -1) command = "down";
  110. else if (td3.indexOf("You snatch the scroll out of the air as it flutters down") != -1) command = "gnusto cleesh";
  111. else if (td3.indexOf("Both the Gnusto scroll and the Cleesh scroll crumble into dust") != -1) command = "up";
  112. else command = "throw ruby bowl";
  113. break;
  114.  
  115. case "Tabletop":
  116. if (td3.indexOf("You acquire an item") != -1) command = "exit";
  117. else if (td3.indexOf("Giant's pinky ring") != -1) command = "get ring";
  118. else if (td3.indexOf("contents have spilled and drained") != -1) command = "exit";
  119. else command = "cleesh giant";
  120. break;
  121.  
  122.  
  123.  
  124. }
  125. } else {
  126. switch(td1) {
  127. case "West of House":
  128. if (td3.indexOf("The house's front door is closed.") != -1) command = "open door";
  129. else if (td3.indexOf("You leave the house.") != -1) command = "north";
  130. else if (td3.indexOf("The front door of the house is standing open.") != -1) command = "east";
  131. break;
  132. case "In the House":
  133. if (td3.indexOf("An ornate sword hangs above the mantel.") != -1) command = "get sword";
  134. else command = "west";
  135. break;
  136. case "North of the Field":
  137. if (td3.indexOf("A hefty stick lies on the ground.") != -1) command = "get stick";
  138. else if (td3.indexOf("A thick hedge blocks the way to the west.") != -1) command = "cut hedge";
  139. else if (td3.indexOf("You leave the clearing.") != -1) command = "north";
  140. else command = "west";
  141. break;
  142. case "Forest Clearing":
  143. if (td3.indexOf("You hold the stick in the flames until it lights.") != -1) command = "east";
  144. else if (td3.indexOf("You don't know what words mean, do you?") != -1 || td3.indexOf("Do what with the what, now?") != -1 || td3.indexOf("You're using words I don't know...") != -1 || td3.indexOf("I don't understand that...") != -1) command = "east";
  145. else command = "light stick";
  146. break;
  147. case "Cave":
  148. if (td3.indexOf("dangerous-looking serpent coiled around it.") != -1) command = "kill serpent";
  149. else if (td3.indexOf("surrounded by hacked-up serpent bits") != -1) command = "open chest";
  150. else if (td3.indexOf("You discover a tiny hole in the wall behind the chest.") != -1 || td3.indexOf("You check to make sure the hole is still there.") != -1) command = "look in hole";
  151. else if (td3.indexOf("You find a grue egg in the hole!") != -1 || td3.indexOf("There's nothing else in the hole.") != -1) {
  152. command = "south";
  153. GM_setValue("newArea","true");
  154. }
  155. else if (td3.indexOf("An empty treasure chest sits near the rear wall.") != -1) command = "look behind chest";
  156. break;
  157. default:
  158. GM_setValue("newArea","true");
  159. break;
  160. }
  161. }
  162. var timeoutCommand = 'document.forms["whatnow"].command.value="'+command+'";';
  163. if (submit == true) timeoutCommand += ' document.forms["whatnow"].submit();'
  164. // GM_log("command="+command+", submit="+submit);
  165. setTimeout(timeoutCommand,100);
  166. }