wsmud_plugins_extends

武神传说 MUD

当前为 2021-07-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name wsmud_plugins_extends
  3. // @namespace cqv
  4. // @version 0.0.2
  5. // @date 09/04/2021
  6. // @modified 14/07/2021
  7. // @homepage 网站链接
  8. // @description 武神传说 MUD
  9. // @author sasamila
  10. // @match http://game.wsmud.com/*
  11. // @match http://www.wsmud.com/*
  12. // @run-at document-end
  13. // @grant unsafeWindow
  14. // @grant GM_getValue
  15. // @grant GM_setValue
  16.  
  17.  
  18. // ==/UserScript==
  19.  
  20. (function () {
  21. 'use strict';
  22.  
  23. var WG = undefined;
  24. var T = undefined;
  25. var G = undefined;
  26. var messageAppend = undefined;
  27. var messageClear = undefined;
  28. $(document).ready(function () {
  29. WG = unsafeWindow.WG;
  30. T = unsafeWindow.T;
  31. G = unsafeWindow.G;
  32. G.SKILL={"unarmed":"none","force":"none","parry":"none","dodge":"none","sword":"none","throwing":"none","blade":"none","whip":"none","club":"none","staff":"none"};
  33. G.XLStatus = false;
  34. G.XLBuffId = undefined;
  35. WG.add_hook("status", function (data) {
  36. if (data.action == "add" && data.sid=='food' && data.name=="玄灵丹") {
  37. G.XLStatus=true;
  38. G.XLBuffId=data.id
  39. }else if (data.action == "remove"&& data.sid=='food' && data.id==G.XLBuffId){
  40. G.XLStatus=false;
  41. G.XLBuffId = undefined;
  42. }
  43. });
  44. WG.add_hook("dialog", function (data) {
  45. if (data.dialog == "skills") {
  46. if (data.items) {
  47. console.log(data.items)
  48. for (let item of data.items) {
  49. if (item.name.indexOf("基本") >= 0) {
  50. G.SKILL[item.id]=item.enable_skill
  51. }
  52. }
  53. }
  54. if (data.enable != undefined) {
  55. for (let item of G.enable_skills) {
  56. if (item.type == data.id) {
  57. item.name = data.enable
  58. break;
  59. }
  60. }
  61. }
  62. }
  63.  
  64.  
  65. });
  66. messageAppend = unsafeWindow.messageAppend;
  67. messageClear = unsafeWindow.messageClear;
  68. T.perform=async function (idx = 0, n, cmds) {
  69. if(G.in_fight){
  70. cmds = T.recmd(idx, cmds);
  71. WG.SendCmd("perform "+n+";"+cmds);
  72. }
  73. };
  74. T.skillPerform=async function (idx = 0, n, cmds) {
  75. if(G.in_fight){
  76. var sksp=n.split(".")
  77. cmds = T.recmd(idx, cmds);
  78. if (sksp[0]==G.SKILL[sksp[1]]){
  79. WG.SendCmd("perform "+sksp[1]+"."+sksp[2]+";"+cmds);
  80. }else{
  81. WG.SendCmd(cmds);
  82. }
  83. }
  84. };
  85. T.xuanling=async function (idx = 0, n, cmds) {
  86. while (!G.XLStatus){
  87. WG.SendCmd("use "+ n);
  88. await WG.sleep(200);
  89. }
  90. };
  91. });
  92. })();