wsmud_plugins_extends

武神传说 MUD

当前为 2022-09-11 提交的版本,查看 最新版本

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