wsmud_plugins_extends

武神传说 MUD

当前为 2021-06-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name wsmud_plugins_extends
  3. // @namespace cqv
  4. // @version 0.0.1
  5. // @date 09/04/2021
  6. // @modified 27/06/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. WG.add_hook("dialog", function (data) {
  34. if (data.dialog == "skills") {
  35. if (data.items) {
  36. console.log(data.items)
  37. for (let item of data.items) {
  38. if (item.name.indexOf("基本") >= 0) {
  39. G.SKILL[item.id]=item.enable_skill
  40. }
  41. }
  42. }
  43. if (data.enable != undefined) {
  44. for (let item of G.enable_skills) {
  45. if (item.type == data.id) {
  46. item.name = data.enable
  47. break;
  48. }
  49. }
  50. }
  51. }
  52.  
  53.  
  54. });
  55. messageAppend = unsafeWindow.messageAppend;
  56. messageClear = unsafeWindow.messageClear;
  57. T.perform=async function (idx = 0, n, cmds) {
  58. if(G.in_fight){
  59. cmds = T.recmd(idx, cmds);
  60. WG.SendCmd("perform "+n+";"+cmds);
  61. }
  62. };
  63. T.skillPerform=async function (idx = 0, n, cmds) {
  64. if(G.in_fight){
  65. var sksp=n.split(".")
  66. cmds = T.recmd(idx, cmds);
  67. if (sksp[0]==G.SKILL[sksp[1]]){
  68. WG.SendCmd("perform "+sksp[1]+"."+sksp[2]+";"+cmds);
  69. }else{
  70. WG.SendCmd(cmds);
  71. }
  72. }
  73. }
  74. });
  75. })();