武神传说之自动续药

这只是一个自动续药的脚本,所以第一颗药还是得自己吃!

  1. // ==UserScript==
  2. // @name 武神传说之自动续药
  3. // @namespace suqing.fun
  4. // @version 0.0.4
  5. // @author sq
  6. // @match http://*.wsmud.com/*
  7. // @homepage https://gf.qytechs.cn/zh-CN/scripts/381751
  8. // @description 这只是一个自动续药的脚本,所以第一颗药还是得自己吃!
  9. // @run-at document-start
  10. // @require http://code.jquery.com/jquery-3.3.1.min.js
  11. // @grant unsafeWindow
  12. // @grant GM_addStyle
  13. // @grant GM_setValue
  14. // @grant GM_deleteValue
  15. // @grant GM_getValue
  16. // @grant GM_setClipboard
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21. let funny = {
  22. sendmessage: function(message) {
  23. if ($("#sendmessage").attr("cmd")) {
  24. $("#sendmessage").attr("cmd", message);
  25. } else {
  26. $(".container").append($(`<span id="sendmessage" cmd="${message}"><span>`));
  27. }
  28. $("#sendmessage").click();
  29. },
  30. onmessage: function(message) {
  31. funny.onmessage_fn.apply(this, arguments);
  32. let data = message.data || "error";
  33. if ((data.includes("{") && data.includes("}")) || (data.includes("[") && data.includes("]"))) {
  34. data = new Function("return " + data + ";")();
  35. }
  36.  
  37. if (typeof data === "string") {
  38. if (data.includes("重新连线") || data.includes("武神传说")) {
  39. $(".content-message pre").append(`\n<hig>自动续药</hig>已加载!\n`);
  40. $("[command=pack]").click();
  41. $(".dialog-close").click();
  42. }
  43. // else if (data.includes("你获得了")) {
  44. // // $(".content-message pre").append(`检测到<wht>${funny.statu}</wht>状态!\n`);
  45. // // if (funny.statu === "蕴象丸") {
  46. // // $(".content-message pre").append(`将会执行 => <wht>${funny.auto_use_yxw}</wht>\n`);
  47. // // funny.sendmessage(funny.auto_use_yxw);
  48. // // } else if (funny.statu === "冰心丹") {
  49. // // $(".content-message pre").append(`将会执行 => <wht>${funny.auto_use_bxd}</wht>\n`);
  50. // // funny.sendmessage(funny.auto_use_bxd);
  51. // // }
  52. // }
  53. } else {
  54.  
  55. if (data.type === "login") {
  56. funny.id = data.id;
  57. } else if (data.type === "dialog" && data.dialog === "pack") {
  58. if (data.items) {
  59. $(".content-message pre").append(`正在检测...\n`);
  60. for (const item of data.items) {
  61. if (item.name.includes("蕴象丸")) {
  62. funny.auto_use_yxw = `use ${item.id}`;
  63. $(".content-message pre").append(`检测到<wht>${item.count}</wht>颗${item.name}!\n`);
  64. $(".content-message pre").append(`蕴象丸状态消失会自动执行 => <wht>${funny.auto_use_yxw}</wht>\n`);
  65. } else if (item.name.includes("冰心丹")) {
  66. funny.auto_use_bxd = `use ${item.id}`;
  67. $(".content-message pre").append(`检测到<wht>${item.count}</wht>颗${item.name}!\n`);
  68. $(".content-message pre").append(`冰心丹状态消失会自动执行 => <wht>${funny.auto_use_bxd}</wht>\n`);
  69. }
  70. }
  71. $(".content-message pre").append(`检测完毕!\n`);
  72. $(".content-message pre").append(`如果显示多种颜色丹药,只会执行最后检测到的!\n`);
  73. $(".content-message pre").append(`如果未显示检测到丹药,请事先将丹药放入背包!\n\n`);
  74. }
  75. } else if (data.type === "status" && data.action === "add" && data.id === funny.id && data.sid === "food") {
  76. funny.statu = data.name;
  77. $(".content-message pre").append(`检测到<hig>${funny.statu}</hig>状态!\n`);
  78. funny.sendmessage("dazuo");
  79. } else if (data.type === "status" && data.action === "remove" && data.id === funny.id && data.sid === "food") {
  80. $(".content-message pre").append(`检测到状态消失!\n`);
  81. funny.sendmessage("stopstate");
  82. if (funny.statu === "蕴象丸") {
  83. funny.sendmessage(funny.auto_use_yxw);
  84. } else if (funny.statu === "冰心丹") {
  85. funny.sendmessage(funny.auto_use_bxd);
  86. }
  87.  
  88. } else if (data.type === "items") {
  89. for (const item of data.items) {
  90. if (item.id === funny.id) {
  91. for (const statu of item.status) {
  92. if (statu.name === "蕴象丸" || statu.name === "冰心丹") {
  93. funny.statu = statu.name;
  94. $(".content-message pre").append(`检测到<wht>${funny.statu}</wht>状态!\n`);
  95. }
  96. }
  97. }
  98. }
  99. }
  100.  
  101. }
  102.  
  103. if (funny.id === "j9h729c52bc") console.log(data);
  104. },
  105. };
  106.  
  107. if (WebSocket) {
  108. unsafeWindow.WebSocket = function(url) {
  109. funny.webSocket = new WebSocket(url);
  110. };
  111. unsafeWindow.WebSocket.prototype = {
  112. get url() {
  113. return funny.webSocket.url;
  114. },
  115. get protocol() {
  116. return funny.webSocket.protocol;
  117. },
  118. get readyState() {
  119. return funny.webSocket.readyState;
  120. },
  121. get bufferedAmount() {
  122. return funny.webSocket.bufferedAmount;
  123. },
  124. get extensions() {
  125. return funny.webSocket.extensions;
  126. },
  127. get binaryType() {
  128. return funny.webSocket.binaryType;
  129. },
  130. set binaryType(type) {
  131. funny.webSocket.binaryType = type;
  132. },
  133. get onerror() {
  134. return funny.webSocket.onerror;
  135. },
  136. set onerror(fn) {
  137. funny.webSocket.onerror = fn;
  138. },
  139. get onopen() {
  140. return funny.webSocket.onopen;
  141. },
  142. set onopen(fn) {
  143. funny.webSocket.onopen = fn;
  144. },
  145. get onclose() {
  146. return funny.webSocket.onclose;
  147. },
  148. set onclose(fn) {
  149. funny.webSocket.onclose = fn;
  150. },
  151. close: function () {
  152. funny.webSocket.close();
  153. },
  154. get onmessage() {
  155. return funny.webSocket.onmessage;
  156. },
  157. set onmessage(fn) {
  158. funny.onmessage_fn = fn;
  159. funny.webSocket.onmessage = funny.onmessage;
  160. },
  161. send: function (message) {
  162. funny.webSocket.send(message);
  163. },
  164. };
  165. }
  166. })();

QingJ © 2025

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