wsmud_pluginss

武神传说 MUD

当前为 2018-11-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name wsmud_pluginss
  3. // @namespace cqv1
  4. // @version 0.0.26.19
  5. // @date 01/07/2018
  6. // @modified 30/11/2018
  7. // @homepage https://greasyfork.org/zh-CN/scripts/374933
  8. // @description 武神传说 MUD
  9. // @author fjcqv(源程序) & zhzhwcn(提供websocket监听)& knva(做了一些微小的贡献)
  10. // @match http://game.wsmud.com/*
  11. // @run-at document-start
  12. // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
  13. // @require https://cdn.bootcss.com/jquery-contextmenu/3.0.0-beta.2/jquery.contextMenu.min.js
  14. // @grant unsafeWindow
  15. // @grant GM_addStyle
  16. // @grant GM_getValue
  17. // @grant GM_setValue
  18. // @grant GM_setClipboard
  19.  
  20. // ==/UserScript==
  21.  
  22. (function () {
  23. 'use strict';
  24. var updateinfo = "增加自动施法开关设置";
  25.  
  26. Array.prototype.baoremove = function (dx) {
  27. if (isNaN(dx) || dx > this.length) {
  28. return false;
  29. }
  30. this.splice(dx, 1);
  31. }
  32.  
  33. if (WebSocket) {
  34. console.log('插件可正常运行,Plugins can run normally');
  35. var _ws = WebSocket,
  36. ws, ws_on_message;
  37. unsafeWindow.WebSocket = function (uri) {
  38. ws = new _ws(uri);
  39. };
  40. unsafeWindow.WebSocket.prototype = {
  41. CONNECTING: _ws.CONNECTING,
  42. OPEN: _ws.OPEN,
  43. CLOSING: _ws.CLOSING,
  44. CLOSED: _ws.CLOSED,
  45. get url() {
  46. return ws.url;
  47. },
  48. get protocol() {
  49. return ws.protocol;
  50. },
  51. get readyState() {
  52. return ws.readyState;
  53. },
  54. get bufferedAmount() {
  55. return ws.bufferedAmount;
  56. },
  57. get extensions() {
  58. return ws.extensions;
  59. },
  60. get binaryType() {
  61. return ws.binaryType;
  62. },
  63. set binaryType(t) {
  64. ws.binaryType = t;
  65. },
  66. get onopen() {
  67. return ws.onopen;
  68. },
  69. set onopen(fn) {
  70. ws.onopen = fn;
  71. },
  72. get onmessage() {
  73. return ws.onmessage;
  74. },
  75. set onmessage(fn) {
  76. ws_on_message = fn;
  77. ws.onmessage = WG.receive_message;
  78. },
  79. get onclose() {
  80. return ws.onclose;
  81. },
  82. set onclose(fn) {
  83. ws.onclose = fn;
  84. },
  85. get onerror() {
  86. return ws.onerror;
  87. },
  88. set onerror(fn) {
  89. ws.onerror = fn;
  90. },
  91. send: function (text) {
  92.  
  93. ws.send(text);
  94. },
  95. close: function () {
  96. ws.close();
  97. }
  98. };
  99. } else {
  100. console.log("插件不可运行,请打开'https://greasyfork.org/zh-CN/forum/discussion/41547/x',按照操作步骤进行操作,Plugins are not functioning properly.plase open https://greasyfork.org/zh-CN/forum/discussion/41547/x");
  101. }
  102. var roomItemSelectIndex = -1;
  103. var timer = 0;
  104. var cnt = 0;
  105. var zb_npc;
  106. var zb_place;
  107. var next = 0;
  108. var roomData = [];
  109.  
  110. var blacklist = ['张无忌', '天山童姥', '枯荣大师', '赵三拳', '洪安通','何红药', '何铁手'];
  111. var blackpfm = ['unarmed.duo'];
  112. var needfind = {
  113. "武当派-林间小径": ["go south"],
  114. "峨眉派-走廊": ["go north", "go south;go south", "go north;go east;go east"],
  115. "丐帮-暗道": ["go east", "go east;go east", "go east"],
  116. "逍遥派-林间小道": ["go west;go north", "go south;go south", "go north;go west"],
  117. "少林派-竹林": ["go north"],
  118. "逍遥派-地下石室": ["go up"],
  119. "逍遥派-木屋": ["go south;go south;go south;go south"]
  120. };
  121. var store_list = [
  122. "<hic>红宝石</hic>",
  123. "<hic>黄宝石</hic>",
  124. "<hic>蓝宝石</hic>",
  125. "<hic>绿宝石</hic>",
  126. "<hiy>精致的红宝石</hiy>",
  127. "<hiy>精致的黄宝石</hiy>",
  128. "<hiy>精致的蓝宝石</hiy>",
  129. "<hiy>精致的绿宝石</hiy>",
  130. "<hiz>完美的红宝石</hiz>",
  131. "<hiz>完美的黄宝石</hiz>",
  132. "<hiz>完美的蓝宝石</hiz>",
  133. "<hiz>完美的绿宝石</hiz>",
  134. "<wht>基本内功秘籍</wht>",
  135. "<wht>基本轻功秘籍</wht>",
  136. "<wht>基本招架秘籍</wht>",
  137. "<wht>基本剑法秘籍</wht>",
  138. "<wht>基本刀法秘籍</wht>",
  139. "<wht>基本拳脚秘籍</wht>",
  140. "<wht>基本暗器秘籍</wht>",
  141. "<wht>基本棍法秘籍</wht>",
  142. "<wht>基本鞭法秘籍</wht>",
  143. "<wht>基本杖法秘籍</wht>",
  144. "<wht>动物皮毛</wht>",
  145. "<wht>家丁服</wht>",
  146. "<wht>家丁鞋</wht>",
  147. "<hig>五虎断门刀残页</hig>",
  148. "<hig>太祖长拳残页</hig>",
  149. "<hig>流氓巾</hig>",
  150. "<hig>流氓衣</hig>",
  151. "<hig>流氓鞋</hig>",
  152. "<hig>流氓护腕</hig>",
  153. "<hig>流氓短剑</hig>",
  154. "<hig>流氓闷棍</hig>",
  155. "<hig>军服</hig>",
  156. "<hig>官服</hig>",
  157. "<hic>崔莺莺的手镯</hic>",
  158. "<hig>崔员外的戒指</hig>",
  159. "<hig>黑虎单刀</hig>",
  160. "<hig>员外披肩</hig>",
  161. "<hig>短衣劲装</hig>",
  162. "进阶残页",
  163. "聚气丹",
  164. "师门令牌",
  165. "喜宴",
  166. "突破丹"
  167. ];
  168. var goods = {
  169. //扬州城-醉仙楼-店小二
  170. "米饭": {
  171. "id": null,
  172. "sales": "店小二",
  173. place: "扬州城-醉仙楼"
  174. },
  175. "包子": {
  176. "id": null,
  177. "sales": "店小二",
  178. place: "扬州城-醉仙楼"
  179. },
  180. "鸡腿": {
  181. "id": null,
  182. "sales": "店小二",
  183. place: "扬州城-醉仙楼"
  184. },
  185. "面条": {
  186. "id": null,
  187. "sales": "店小二",
  188. place: "扬州城-醉仙楼"
  189. },
  190. "扬州炒饭": {
  191. "id": null,
  192. "sales": "店小二",
  193. place: "扬州城-醉仙楼"
  194. },
  195. "米酒": {
  196. "id": null,
  197. "sales": "店小二",
  198. place: "扬州城-醉仙楼"
  199. },
  200. "花雕酒": {
  201. "id": null,
  202. "sales": "店小二",
  203. place: "扬州城-醉仙楼"
  204. },
  205. "女儿红": {
  206. "id": null,
  207. "sales": "店小二",
  208. place: "扬州城-醉仙楼"
  209. },
  210. "醉仙酿": {
  211. "id": null,
  212. "sales": "店小二",
  213. place: "扬州城-醉仙楼"
  214. },
  215. "神仙醉": {
  216. "id": null,
  217. "sales": "店小二",
  218. place: "扬州城-醉仙楼"
  219. },
  220. //扬州城-杂货铺
  221. "布衣": {
  222. "id": null,
  223. "sales": "杂货铺老板 杨永福",
  224. place: "扬州城-杂货铺"
  225. },
  226. "钢刀": {
  227. "id": null,
  228. "sales": "杂货铺老板 杨永福",
  229. place: "扬州城-杂货铺"
  230. },
  231. "木棍": {
  232. "id": null,
  233. "sales": "杂货铺老板 杨永福",
  234. place: "扬州城-杂货铺"
  235. },
  236. "英雄巾": {
  237. "id": null,
  238. "sales": "杂货铺老板 杨永福",
  239. place: "扬州城-杂货铺"
  240. },
  241. "布鞋": {
  242. "id": null,
  243. "sales": "杂货铺老板 杨永福",
  244. place: "扬州城-杂货铺"
  245. },
  246. "铁戒指": {
  247. "id": null,
  248. "sales": "杂货铺老板 杨永福",
  249. place: "扬州城-杂货铺"
  250. },
  251. "簪子": {
  252. "id": null,
  253. "sales": "杂货铺老板 杨永福",
  254. place: "扬州城-杂货铺"
  255. },
  256. "长鞭": {
  257. "id": null,
  258. "sales": "杂货铺老板 杨永福",
  259. place: "扬州城-杂货铺"
  260. },
  261. "钓鱼竿": {
  262. "id": null,
  263. "sales": "杂货铺老板 杨永福",
  264. place: "扬州城-杂货铺"
  265. },
  266. "鱼饵": {
  267. "id": null,
  268. "sales": "杂货铺老板 杨永福",
  269. place: "扬州城-杂货铺"
  270. },
  271.  
  272. //扬州城-打铁铺
  273. "铁剑": {
  274. "id": null,
  275. "sales": "铁匠铺老板 铁匠",
  276. place: "扬州城-打铁铺"
  277. },
  278. "钢刀": {
  279. "id": null,
  280. "sales": "铁匠铺老板 铁匠",
  281. place: "扬州城-打铁铺"
  282. },
  283. "铁棍": {
  284. "id": null,
  285. "sales": "铁匠铺老板 铁匠",
  286. place: "扬州城-打铁铺"
  287. },
  288. "铁杖": {
  289. "id": null,
  290. "sales": "铁匠铺老板 铁匠",
  291. place: "扬州城-打铁铺"
  292. },
  293. "铁镐": {
  294. "id": null,
  295. "sales": "铁匠铺老板 铁匠",
  296. place: "扬州城-打铁铺"
  297. },
  298.  
  299. //扬州城-药铺
  300. "金创药": {
  301. "id": null,
  302. "sales": "药铺老板 平一指",
  303. place: "扬州城-药铺"
  304. },
  305. "引气丹": {
  306. "id": null,
  307. "sales": "药铺老板 平一指",
  308. place: "扬州城-药铺"
  309. },
  310. "养精丹": {
  311. "id": null,
  312. "sales": "药铺老板 平一指",
  313. place: "扬州城-药铺"
  314. },
  315. };
  316. var equip = {
  317. "铁镐": 0,
  318. };
  319. var npcs = {
  320. "店小二": 0
  321. };
  322. var place = {
  323. "住房": "jh fam 0 start;go west;go west;go north;go enter",
  324. "练功房": "jh fam 0 start;go west;go west;go north;go enter;go west;xiulian",
  325. "仓库": "jh fam 0 start;go north;go west;store",
  326. "扬州城-醉仙楼": "jh fam 0 start;go north;go north;go east",
  327. "扬州城-杂货铺": "jh fam 0 start;go east;go south",
  328. "扬州城-打铁铺": "jh fam 0 start;go east;go east;go south",
  329. "扬州城-药铺": "jh fam 0 start;go east;go east;go north",
  330. "扬州城-衙门正厅": "jh fam 0 start;go west;go north;go north",
  331. "扬州城-矿山": "jh fam 0 start;go west;go west;go west;go west",
  332. "扬州城-喜宴": "jh fam 0 start;go north;go north;go east;go up",
  333. "扬州城-擂台": "jh fam 0 start;go west;go south",
  334. "扬州城-当铺": "jh fam 0 start;go south;go east",
  335. "扬州城-帮派": "jh fam 0 start;go south;go south;go east",
  336. "扬州城-扬州武馆": "jh fam 0 start;go south;go south;go west",
  337. "扬州城-武庙": "jh fam 0 start;go north;go north;go west",
  338. "武当派-广场": "jh fam 1 start;",
  339. "武当派-三清殿": "jh fam 1 start;go north",
  340. "武当派-石阶": "jh fam 1 start;go west",
  341. "武当派-练功房": "jh fam 1 start;go west;go west",
  342. "武当派-太子岩": "jh fam 1 start;go west;go northup",
  343. "武当派-桃园小路": "jh fam 1 start;go west;go northup;go north",
  344. "武当派-舍身崖": "jh fam 1 start;go west;go northup;go north;go east",
  345. "武当派-南岩峰": "jh fam 1 start;go west;go northup;go north;go west",
  346. "武当派-乌鸦岭": "jh fam 1 start;go west;go northup;go north;go west;go northup",
  347. "武当派-五老峰": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup",
  348. "武当派-虎头岩": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup",
  349. "武当派-朝天宫": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup;go north",
  350. "武当派-三天门": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup;go north;go north",
  351. "武当派-紫金城": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup;go north;go north;go north",
  352. "武当派-林间小径": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup;go north;go north;go north;go north;go north",
  353. "武当派-后山小院": "jh fam 1 start;go west;go northup;go north;go west;go northup;go northup;go northup;go north;go north;go north;go north;go north;go north",
  354. "少林派-广场": "jh fam 2 start;",
  355. "少林派-山门殿": "jh fam 2 start;go north",
  356. "少林派-东侧殿": "jh fam 2 start;go north;go east",
  357. "少林派-西侧殿": "jh fam 2 start;go north;go west",
  358. "少林派-天王殿": "jh fam 2 start;go north;go north",
  359. "少林派-大雄宝殿": "jh fam 2 start;go north;go north;go northup",
  360. "少林派-钟楼": "jh fam 2 start;go north;go north;go northeast",
  361. "少林派-鼓楼": "jh fam 2 start;go north;go north;go northwest",
  362. "少林派-后殿": "jh fam 2 start;go north;go north;go northwest;go northeast",
  363. "少林派-练武场": "jh fam 2 start;go north;go north;go northwest;go northeast;go north",
  364. "少林派-罗汉堂": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go east",
  365. "少林派-般若堂": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go west",
  366. "少林派-方丈楼": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north",
  367. "少林派-戒律院": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north;go east",
  368. "少林派-达摩院": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north;go west",
  369. "少林派-竹林": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north;go north;go north",
  370. "少林派-藏经阁": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north;go north;go west",
  371. "少林派-达摩洞": "jh fam 2 start;go north;go north;go northwest;go northeast;go north;go north;go north;go north;go north",
  372. "华山派-镇岳宫": "jh fam 3 start;",
  373. "华山派-苍龙岭": "jh fam 3 start;go eastup",
  374. "华山派-舍身崖": "jh fam 3 start;go eastup;go southup",
  375. "华山派-峭壁": "jh fam 3 start;go eastup;go southup;jumpdown",
  376. "华山派-山谷": "jh fam 3 start;go eastup;go southup;jumpdown;go southup",
  377. "华山派-山间平地": "jh fam 3 start;go eastup;go southup;jumpdown;go southup;go south",
  378. "华山派-林间小屋": "jh fam 3 start;go eastup;go southup;jumpdown;go southup;go south;go east",
  379. "华山派-玉女峰": "jh fam 3 start;go westup",
  380. "华山派-玉女祠": "jh fam 3 start;go westup;go west",
  381. "华山派-练武场": "jh fam 3 start;go westup;go north",
  382. "华山派-练功房": "jh fam 3 start;go westup;go north;go east",
  383. "华山派-客厅": "jh fam 3 start;go westup;go north;go north",
  384. "华山派-偏厅": "jh fam 3 start;go westup;go north;go north;go east",
  385. "华山派-寝室": "jh fam 3 start;go westup;go north;go north;go north",
  386. "华山派-玉女峰山路": "jh fam 3 start;go westup;go south",
  387. "华山派-玉女峰小径": "jh fam 3 start;go westup;go south;go southup",
  388. "华山派-思过崖": "jh fam 3 start;go westup;go south;go southup;go southup",
  389. "华山派-山洞": "jh fam 3 start;go westup;go south;go southup;go southup;break bi;go enter",
  390. "华山派-长空栈道": "jh fam 3 start;go westup;go south;go southup;go southup;break bi;go enter;go westup",
  391. "华山派-落雁峰": "jh fam 3 start;go westup;go south;go southup;go southup;break bi;go enter;go westup;go westup",
  392. "华山派-华山绝顶": "jh fam 3 start;go westup;go south;go southup;go southup;break bi;go enter;go westup;go westup;jumpup",
  393. "峨眉派-金顶": "jh fam 4 start",
  394. "峨眉派-庙门": "jh fam 4 start;go west",
  395. "峨眉派-广场": "jh fam 4 start;go west;go south",
  396. "峨眉派-走廊": "jh fam 4 start;go west;go south;go west",
  397. "峨眉派-休息室": "jh fam 4 start;go west;go south;go east;go south",
  398. "峨眉派-厨房": "jh fam 4 start;go west;go south;go east;go east",
  399. "峨眉派-练功房": "jh fam 4 start;go west;go south;go west;go west",
  400. "峨眉派-小屋": "jh fam 4 start;go west;go south;go west;go north;go north",
  401. "峨眉派-清修洞": "jh fam 4 start;go west;go south;go west;go south;go south",
  402. "峨眉派-大殿": "jh fam 4 start;go west;go south;go south",
  403. "峨眉派-睹光台": "jh fam 4 start;go northup",
  404. "峨眉派-华藏庵": "jh fam 4 start;go northup;go east",
  405. "逍遥派-青草坪": "jh fam 5 start",
  406. "逍遥派-林间小道": "jh fam 5 start;go east",
  407. "逍遥派-练功房": "jh fam 5 start;go east;go north",
  408. "逍遥派-木板路": "jh fam 5 start;go east;go south",
  409. "逍遥派-工匠屋": "jh fam 5 start;go east;go south;go south",
  410. "逍遥派-休息室": "jh fam 5 start;go west;go south",
  411. "逍遥派-木屋": "jh fam 5 start;go north;go north",
  412. "逍遥派-地下石室": "jh fam 5 start;go down;go down",
  413. "丐帮-树洞内部": "jh fam 6 start",
  414. "丐帮-树洞下": "jh fam 6 start;go down",
  415. "丐帮-暗道": "jh fam 6 start;go down;go east",
  416. "丐帮-破庙密室": "jh fam 6 start;go down;go east;go east;go east",
  417. "丐帮-土地庙": "jh fam 6 start;go down;go east;go east;go east;go up",
  418. "丐帮-林间小屋": "jh fam 6 start;go down;go east;go east;go east;go east;go east;go up",
  419. "襄阳城-广场": "jh fam 7 start",
  420. "武道塔": "jh fam 8 start"
  421. };
  422. var drop_list = ['欠条'];
  423. var fenjie_list = [];
  424.  
  425. var role;
  426. var family = null;
  427. var sm_loser = null;
  428. var wudao_pfm = "1";
  429. var ks_pfm = "2000";
  430. var automarry = null;
  431. var autoKsBoss = null;
  432. var showHP = null;
  433. var eqlist = {1: [], 2: [],3: []};
  434. var unauto_pfm = '';
  435. var auto_pfmswitch = null;
  436. var autoeq = 0;
  437. //快捷键功能
  438. var KEY = {
  439. keys: [],
  440. roomItemSelectIndex: -1,
  441. init: function () {
  442. //添加快捷键说明
  443. $("span[command=stopstate] span:eq(0)").html("S");
  444. $("span[command=showcombat] span:eq(0)").html("A");
  445. $("span[command=showtool] span:eq(0)").html("C");
  446. $("span[command=pack] span:eq(0)").html("B");
  447. $("span[command=tasks] span:eq(0)").html("L");
  448. $("span[command=score] span:eq(0)").html("O");
  449. $("span[command=jh] span:eq(0)").html("J");
  450. $("span[command=skills] span:eq(0)").html("K");
  451. $("span[command=message] span:eq(0)").html("U");
  452. $("span[command=shop] span:eq(0)").html("P");
  453. $("span[command=stats] span:eq(0)").html("I");
  454. $("span[command=setting] span:eq(0)").html(",");
  455.  
  456. $(document).on("keydown", this.e);
  457.  
  458. this.add(27, function () {KEY.dialog_close();});
  459. this.add(192, function () {$(".map-icon").click();});
  460. this.add(32, function () {KEY.dialog_confirm();});
  461. this.add(83, function () {KEY.do_command("stopstate");});
  462. this.add(13, function () {KEY.do_command("showchat");});
  463. this.add(65, function () {KEY.do_command("showcombat");});
  464. this.add(67, function () {KEY.do_command("showtool");});
  465. this.add(66, function () {KEY.do_command("pack");});
  466. this.add(76, function () { KEY.do_command("tasks"); });
  467. this.add(79, function () {KEY.do_command("score");});
  468. this.add(74, function () {KEY.do_command("jh");});
  469. this.add(75, function () {KEY.do_command("skills");});
  470. this.add(73, function () {KEY.do_command("stats");});
  471. this.add(85, function () {KEY.do_command("message");});
  472. this.add(80, function () {KEY.do_command("shop");});
  473. this.add(188, function () {KEY.do_command("setting");});
  474.  
  475. this.add(81, function () { WG.sm_button();});
  476. this.add(87, function () {WG.go_yamen_task();});
  477. this.add(69, function () {WG.kill_all();});
  478. this.add(82, function () {WG.get_all();});
  479. this.add(84, function () {WG.sell_all();});
  480. this.add(89, function () {WG.zdwk();});
  481.  
  482. this.add(9, function () {//TAB
  483. KEY.onRoomItemSelect();
  484. return false;
  485. });
  486.  
  487. //方向
  488. this.add(102, function () {
  489. WG.Send("go east");
  490. KEY.onChangeRoom();
  491. });
  492. this.add(39, function () {
  493. WG.Send("go east");
  494. KEY.onChangeRoom();
  495. });
  496. this.add(100, function () {
  497. WG.Send("go west");
  498. KEY.onChangeRoom();
  499. });
  500. this.add(37, function () {
  501. WG.Send("go west");
  502. KEY.onChangeRoom();
  503. });
  504. this.add(98, function () {
  505. WG.Send("go south");
  506. KEY.onChangeRoom();
  507. });
  508. this.add(40, function () {
  509. WG.Send("go south");
  510. KEY.onChangeRoom();
  511. });
  512. this.add(104, function () {
  513. WG.Send("go go north");
  514. KEY.onChangeRoom();
  515. });
  516. this.add(38, function () {
  517. WG.Send("go north");
  518. KEY.onChangeRoom();
  519. });
  520. this.add(99, function () {
  521. WG.Send("go southeast");
  522. KEY.onChangeRoom();
  523. });
  524. this.add(97, function () {
  525. WG.Send("go southwest");
  526. KEY.onChangeRoom();
  527. });
  528. this.add(105, function () {
  529. WG.Send("go northeast");
  530. KEY.onChangeRoom();
  531. });
  532. this.add(103, function () {
  533. WG.Send("go northwest");
  534. KEY.onChangeRoom();
  535. });
  536.  
  537. this.add(49, function () {KEY.combat_commands(0);});
  538. this.add(50, function () {KEY.combat_commands(1);});
  539. this.add(51, function () {KEY.combat_commands(2);});
  540. this.add(52, function () {KEY.combat_commands(3);});
  541. this.add(53, function () {KEY.combat_commands(4);});
  542. this.add(54, function () {KEY.combat_commands(5);});
  543. this.add(55, function () {KEY.combat_commands(6);});
  544. this.add(56, function () {KEY.combat_commands(7);});
  545. this.add(57, function () {KEY.combat_commands(8);});
  546.  
  547. //alt
  548. this.add(49 + 512, function () {KEY.onRoomItemAction(0);});
  549. this.add(50 + 512, function () {KEY.onRoomItemAction(1);});
  550. this.add(51 + 512, function () {KEY.onRoomItemAction(2);});
  551. this.add(52 + 512, function () {KEY.onRoomItemAction(3);});
  552. this.add(53 + 512, function () {KEY.onRoomItemAction(4);});
  553. this.add(54 + 512, function () {KEY.onRoomItemAction(5);});
  554. //ctrl
  555. this.add(49 + 1024, function () {KEY.room_commands(0);});
  556. this.add(50 + 1024, function () {KEY.room_commands(1);});
  557. this.add(51 + 1024, function () {KEY.room_commands(2);});
  558. this.add(52 + 1024, function () {KEY.room_commands(3);});
  559. this.add(53 + 1024, function () {KEY.room_commands(4);});
  560. this.add(54 + 1024, function () {KEY.room_commands(5);});
  561. },
  562. add: function (k, c) {
  563. var tmp = {
  564. key: k,
  565. callback: c,
  566. };
  567. this.keys.push(tmp);
  568. },
  569. e: function (event) {
  570. if ($(".channel-box").is(":visible")) {
  571. KEY.chatModeKeyEvent(event);
  572. return;
  573. }
  574.  
  575. if ($(".dialog-confirm").is(":visible") &&
  576. ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105)))
  577. return;
  578.  
  579. var kk = (event.ctrlKey || event.metaKey ? 1024 : 0) + (event.altKey ? 512 : 0) + event.keyCode;
  580. for (var k of KEY.keys) {
  581. if (k.key == kk)
  582. return k.callback();
  583. }
  584. },
  585. dialog_close: function () {
  586. $(".dialog-close").click();
  587. },
  588. dialog_confirm: function () {
  589. $(".dialog-btn.btn-ok").click();
  590. },
  591. do_command: function (name) {
  592. $("span[command=" + name + "]").click();
  593. },
  594. room_commands: function (index) {
  595. $("div.combat-panel div.room-commands span:eq(" + index + ")").click();
  596. },
  597. combat_commands: function (index) {
  598. $("div.combat-panel div.combat-commands span.pfm-item:eq(" + index + ")").click();
  599. },
  600. chatModeKeyEvent: function (event) {
  601. if (event.keyCode == 27) {
  602. KEY.dialog_close();
  603. } else if (event.keyCode == 13) {
  604. if ($(".sender-box").val().length) $(".sender-btn").click();
  605. else KEY.dialog_close();
  606. }
  607. },
  608. onChangeRoom: function () {
  609. KEY.roomItemSelectIndex = -1;
  610. },
  611. onRoomItemSelect: function () {
  612. if (KEY.roomItemSelectIndex != -1) {
  613. $(".room_items div.room-item:eq(" + KEY.roomItemSelectIndex + ")").css("background", "#000");
  614. }
  615. KEY.roomItemSelectIndex = (KEY.roomItemSelectIndex + 1) % $(".room_items div.room-item").length;
  616. var curItem = $(".room_items div.room-item:eq(" + KEY.roomItemSelectIndex + ")");
  617. curItem.css("background", "#444");
  618. curItem.click();
  619. },
  620. onRoomItemAction: function (index) {
  621. //NPC下方按键
  622. $(".room_items .item-commands span:eq(" + index + ")").click();
  623. },
  624. }
  625. function messageClear() {$(".WG_log pre").html("");}
  626. var log_line = 0;
  627. function messageAppend(m, t = 0) {
  628. 100 < log_line && (log_line = 0, $(".WG_log pre").empty());
  629. var ap = m + "\n";
  630. if (t == 1) {ap = "<hiy>" + ap + "</hiy>";
  631. }
  632. else if (t == 2) {ap = "<hig>" + ap + "</hig>";
  633. }
  634. else if (t == 3) {ap = "<hiw>" + ap + "</hiw>";
  635. }
  636. $(".WG_log pre").append(ap);
  637. log_line++;
  638. $(".WG_log")[0].scrollTop = 99999;
  639. }
  640. var sm_array = {
  641. '武当': {place: "武当派-三清殿",npc: "武当派第二代弟子 武当首侠 宋远桥"},
  642. '华山': {place: "华山派-客厅",npc: "华山派掌门 君子剑 岳不群"},
  643. '少林': {place: "少林派-天王殿",npc: "少林寺第三十九代弟子 道觉禅师"},
  644. '逍遥': {place: "逍遥派-青草坪",npc: "聪辩老人 苏星河"},
  645. '丐帮': {place: "丐帮-树洞下",npc: "丐帮七袋弟子 左全"},
  646. '峨眉': {place: "峨眉派-大殿",npc: "峨嵋派第四代弟子 静心"},
  647. '武馆': {place: "扬州城-扬州武馆",npc: "武馆教习"},
  648. };
  649. var WG = {
  650. sm_state: -1,
  651. sm_item: null,
  652. init: function () {
  653. $("li[command=SelectRole]").on("click", function () {
  654. WG.login();
  655. });
  656. },
  657. inArray: function (val, arr) {
  658. for (let i = 0; i < arr.length; i++) {
  659. let item = arr[i];
  660. if (item[0] == "<") {
  661. if (item == val) return true;
  662.  
  663. } else {
  664. if (val.indexOf(item) >= 0) return true;
  665. }
  666. }
  667. return false;
  668. },
  669. login: function () {
  670. role = $('.role-list .select').text().split(/[\s\n]/).pop();
  671. $(".bottom-bar").append("<span class='item-commands' style='display:none'><span WG='WG' cmd=''></span></span>"); //命令行模块
  672. var html = `
  673. <div class='WG_log'><pre></pre></div>
  674. <div style = " width: calc(100% - 40px);" >
  675. <span class='zdy-item sm_button'>师门Q</span>
  676. <span class='zdy-item go_yamen_task'>追捕W</span>
  677. <span class='zdy-item kill_all'>击杀E</span>
  678. <span class='zdy-item get_all'>拾取R</span>
  679. <span class='zdy-item sell_all'>清包T</span>
  680. <span class='zdy-item zdwk'>挖矿Y</span>
  681. <span class = "zdy-item auto_perform" style = "float:right;" >自动攻击</span>
  682. </div>
  683. `;
  684. $(".content-message").after(html);
  685. var css = `.zdy-item{
  686. display: inline-block;border: solid 1px gray;color: gray;background-color: black;
  687. text-align: center;cursor: pointer;border-radius: 0.25em;min-width: 2.5em;margin-right: 0.4em;
  688. margin-left: 0.4em;position: relative;padding-left: 0.4em;padding-right: 0.4em;line-height: 2em;}
  689. .WG_log{flex: 1;overflow-y: auto;border: 1px solid #404000;max-height: 15em;width: calc(100% - 40px);}
  690. .WG_log > pre{margin: 0px; white-space: pre-line;}
  691. .item-plushp{display: inline-block;float: right;width: 100px;}
  692. .item-dps{display: inline-block;float: right;width: 100px;}
  693. `;
  694. GM_addStyle(css);
  695. goods = GM_getValue("goods", goods);
  696. npcs = GM_getValue("npcs", npcs);
  697. equip = GM_getValue(role + "_equip", equip);
  698. family = GM_getValue(role + "_family", family);
  699. automarry = GM_getValue(role + "_automarry", automarry);
  700. autoKsBoss = GM_getValue(role + "_autoKsBoss", autoKsBoss);
  701. showHP = GM_getValue(role + "_showHP", showHP);
  702. ks_pfm = GM_getValue(role + "_ks_pfm", ks_pfm);
  703. eqlist = GM_getValue(role + "_eqlist", eqlist);
  704. autoeq = GM_getValue(role + "_auto_eq", autoeq);
  705. if (family == null) {
  706. family = $('.role-list .select').text().substr(0, 2);
  707. }
  708. wudao_pfm = GM_getValue(role + "_wudao_pfm", wudao_pfm);
  709. sm_loser = GM_getValue(role + "_sm_loser", sm_loser);
  710. unauto_pfm = GM_getValue(role + "_unauto_pfm", unauto_pfm);
  711. auto_pfmswitch = GM_getValue(role + "_auto_pfmswitch", auto_pfmswitch);
  712. if(auto_pfmswitch=='已开启'){
  713. G.auto_preform =true;
  714. }
  715. var unpfm = unauto_pfm.split(',');
  716. for(var pfmname of unpfm){
  717. if(pfmname)
  718. blackpfm.push(pfmname);
  719. }
  720. $(".sm_button").on("click", WG.sm_button);
  721. $(".go_yamen_task").on("click", WG.go_yamen_task);
  722. $(".kill_all").on("click", WG.kill_all);
  723. $(".get_all").on("click", WG.get_all);
  724. $(".sell_all").on("click", WG.clean_all);
  725. $(".zdwk").on("click", WG.zdwk);
  726. $(".auto_perform").on("click", WG.auto_preform_switch);
  727. setTimeout(() => {
  728. role = role;
  729. var logintext = '';
  730. document.title = role + "-MUD游戏-武神传说";
  731.  
  732. KEY.do_command("showtool");
  733. KEY.do_command("pack");
  734. KEY.do_command("score");
  735. setTimeout(() => {
  736. KEY.do_command("score");
  737. var rolep = role;
  738. if (G.level) {
  739. rolep = G.level + role;
  740. }
  741. if (WebSocket) {
  742. if (npcs['店小二'] == 0) {
  743. logintext = `
  744. <hiy>欢迎${rolep},插件已加载!第一次使用,请在设置中,初始化ID,并且设置一下是否自动婚宴,自动传送boss
  745. 插件版本: ${GM_info.script.version}
  746. </hiy>`;
  747. } else {
  748. logintext = `
  749. <hiy>欢迎${rolep},插件已加载!
  750. 插件版本: ${GM_info.script.version}
  751. 更新日志: ${updateinfo}
  752. </hiy>`;
  753. }
  754. } else {
  755. logintext = `
  756. <hiy>欢迎${role},插件未正常加载!
  757. 当前浏览器不支持自动喜宴自动boss,请使用火狐浏览器
  758. 谷歌系浏览器,请在network中勾选disable cache,多刷新几次,直至提示已加载!
  759. 插件版本: ${GM_info.script.version}
  760. </hiy>`;
  761. }
  762. messageAppend(logintext);
  763.  
  764. }, 500);
  765. KEY.do_command("showcombat");
  766. }, 1000);
  767. },
  768. updete_goods_id: function () {
  769. var lists = $(".dialog-list > .obj-list:first");
  770. var id;
  771. var name;
  772. if (lists.length) {
  773. messageAppend("检测到商品清单");
  774. for (var a of lists.children()) {
  775. a = $(a);
  776. id = a.attr("obj");
  777. name = $(a.children()[0]).html();
  778. goods[name].id = id;
  779. messageAppend(name + ":" + id);
  780. }
  781. GM_setValue("goods", goods);
  782. return true;
  783. } else {
  784. messageAppend("未检测到商品清单");
  785. return false;
  786. }
  787. },
  788. updete_npc_id: function () {
  789. var lists = $(".room_items .room-item");
  790.  
  791. for (var npc of lists) {
  792. if (npc.lastElementChild.lastElementChild == null) {
  793. npcs[npc.lastElementChild.innerText] = $(npc).attr("itemid");
  794. messageAppend(npc.lastElementChild.innerText + " 的ID:" + $(npc).attr("itemid"));
  795. }
  796. }
  797. GM_setValue("npcs", npcs);
  798. },
  799. updete_id_all: function () {
  800. var t = [];
  801. Object.keys(goods).forEach(function (key) {
  802. if (t[goods[key].place] == undefined)
  803. t[goods[key].place] = goods[key].sales;
  804. });
  805. var keys = Object.keys(t);
  806. var i = 0;
  807. var state = 0;
  808. var place, sales;
  809. //获取
  810. var timer = setInterval(() => {
  811. switch (state) {
  812. case 0:
  813. if (i >= keys.length) {
  814. messageAppend("初始化完成");
  815. WG.go("武当派-广场");
  816. clearInterval(timer);
  817. return;
  818. }
  819. place = keys[i];
  820. sales = t[place];
  821. WG.go(place);
  822. state = 1;
  823. break;
  824. case 1:
  825. WG.updete_npc_id();
  826. var id = npcs[sales];
  827. WG.Send("list " + id);
  828. state = 2;
  829. break;
  830. case 2:
  831. if (WG.updete_goods_id()) {
  832. state = 0;
  833. i++;
  834. } else
  835. state = 1;
  836. break;
  837. }
  838. }, 1000);
  839. },
  840. Send: async function (cmd) {
  841. if (cmd) {
  842. cmd = cmd instanceof Array ? cmd : cmd.split(';');
  843. for (var c of cmd) {
  844. $("span[WG='WG']").attr("cmd", c).click();
  845.  
  846. };
  847. }
  848. },
  849. sleep(time) {
  850. return new Promise((resolve) => setTimeout(resolve, time));
  851. },
  852. go: async function (p) {
  853. if (needfind[p] == undefined) {
  854. if (WG.at(p)) {
  855. return;
  856. }
  857. }
  858. if (place[p] != undefined) {
  859. WG.Send(place[p]);
  860. }
  861. },
  862. at: function (p) {
  863. var w = $(".room-name").html();
  864. return w.indexOf(p) == -1 ? false : true;
  865. },
  866. smhook: undefined,
  867. sm: function () {
  868. if (!WG.smhook) {
  869. WG.smhook = WG.add_hook('text', function (data) {
  870. if (data.msg.indexOf("辛苦了, 你先去休息") >= 0 ||
  871. data.msg.indexOf("和本门毫无瓜葛") >= 0 ||
  872. data.msg.indexOf("你没有") >= 0
  873. ) {
  874. //WG.Send("taskover signin");
  875. WG.sm_state = -1;
  876. $(".sm_button").text("师门Q");
  877. WG.remove_hook(WG.smhook);
  878. WG.smhook = undefined;
  879. messageAppend("自动去挖矿");
  880. setTimeout(WG.zdwk, 2000);
  881.  
  882. }
  883. });
  884. }
  885. switch (WG.sm_state) {
  886. case 0://前往师门接收任务
  887. WG.go(sm_array[family].place);
  888. WG.sm_state = 1;
  889. setTimeout(WG.sm, 700);
  890. break;
  891. case 1: //接受任务
  892. var lists = $(".room_items .room-item");
  893. var id = null;
  894. for (var npc of lists) {
  895. if (npc.lastElementChild.lastElementChild == null) {
  896. if (npc.lastElementChild.innerText == sm_array[family].npc)
  897. id = $(npc).attr("itemid");
  898. }
  899. }
  900. console.log(id);
  901. if (id != undefined) {
  902. WG.Send("task sm " + id);
  903. WG.Send("task sm " + id);
  904. WG.sm_state = 2;
  905. } else {
  906. WG.updete_npc_id();
  907. }
  908. setTimeout(WG.sm, 300);
  909. break;
  910. case 2:
  911. var mysm_loser = GM_getValue(role + "_sm_loser", sm_loser);
  912. //获取师门任务物品
  913. var item = $("span[cmd$='giveup']:last").parent().prev();
  914. if (item.length == 0) {
  915. WG.sm_state = 0;
  916. setTimeout(WG.sm, 1000);
  917. return;
  918. };
  919. var itemName = item.html();
  920. item = item[0].outerHTML;
  921. //(逗比写法) //能上交直接上交
  922. var tmpObj = $("span[cmd$='giveup']:last").prev();
  923. for (let i = 0; i < 6; i++) {
  924. if (tmpObj.children().html()) {
  925. if (tmpObj.html().indexOf(item) >= 0) {
  926. tmpObj.click();
  927. messageAppend("自动上交" + item);
  928. WG.sm_state = 0;
  929. setTimeout(WG.sm, 100);
  930. return;
  931. }
  932. tmpObj = tmpObj.prev();
  933. }
  934. }
  935. //不能上交自动购买
  936. WG.sm_item = goods[itemName];
  937. if (WG.sm_item != undefined) {
  938. WG.go(WG.sm_item.place);
  939. messageAppend("自动购买" + item);
  940. WG.sm_state = 3;
  941. setTimeout(WG.sm, 1000);
  942. } else {
  943. messageAppend("无法购买" + item);
  944. if (mysm_loser == '已停止') {
  945. WG.sm_state = -1;
  946. $(".sm_button").text("师门(Q)");
  947. } else {
  948. $("span[cmd$='giveup']:last").click();
  949. messageAppend("放弃任务");
  950. WG.sm_state = 0;
  951. setTimeout(WG.sm, 100);
  952. return;
  953. }
  954. }
  955. break;
  956. case 3:
  957. WG.go(WG.sm_item.place);
  958. if (WG.buy(WG.sm_item)) {
  959. WG.sm_state = 0;
  960. }
  961. setTimeout(WG.sm, 1000);
  962. break;
  963. default:
  964. break;
  965. }
  966. },
  967. sm_button: function () {
  968. if (WG.sm_state >= 0) {
  969. WG.sm_state = -1;
  970. $(".sm_button").text("师门(Q)");
  971. } else {
  972. WG.sm_state = 0;
  973. $(".sm_button").text("停止(Q)");
  974. setTimeout(WG.sm, 200);
  975. }
  976. },
  977. buy: function (good) {
  978. var tmp = npcs[good.sales];
  979. if (tmp == undefined) {
  980. WG.updete_npc_id();
  981. return false;
  982. }
  983. WG.Send("list " + tmp);
  984. WG.Send("buy 1 " + good.id + " from " + tmp);
  985. return true;
  986. },
  987. Give: function (items) {
  988. var tmp = npcs["店小二"];
  989. if (tmp == undefined) {
  990. WG.updete_npc_id();
  991. return false;
  992. }
  993. WG.Send("give " + tmp + " " + items);
  994. return true;
  995.  
  996. },
  997. eq: function (e) {
  998. WG.Send("eq " + equip[e]);
  999. },
  1000. ask: function (npc, i) {
  1001. npc = npcs[npc];
  1002. if (npc != undefined)
  1003. WG.Send("ask" + i + " " + npc);
  1004. else
  1005. WG.updete_npc_id();
  1006. },
  1007. yamen_lister: undefined,
  1008. go_yamen_task: async function () {
  1009. if (!WG.yamen_lister) {
  1010. WG.yamen_lister = WG.add_hook('text', function (data) {
  1011. if (data.msg.indexOf("最近没有在逃的逃犯了,你先休息下吧。") >= 0) {
  1012. clearInterval(WG.check_yamen_task);
  1013. WG.check_yamen_task = 'over';
  1014. WG.remove_hook(WG.yamen_lister);
  1015. WG.yamen_lister = undefined;
  1016.  
  1017. } else if (data.msg.indexOf("没有这个人") >= 0) {
  1018. WG.updete_npc_id();
  1019. }
  1020. });
  1021. }
  1022. WG.go("扬州城-衙门正厅");
  1023. await WG.sleep(200);
  1024. WG.updete_npc_id();
  1025. WG.ask("扬州知府 程药发", 1);
  1026. if (WG.check_yamen_task == 'over') {
  1027. return;
  1028. }
  1029. window.setTimeout(WG.check_yamen_task, 1000);
  1030. },
  1031.  
  1032. check_yamen_task: function () {
  1033. if (WG.check_yamen_task == 'over') {
  1034. return;
  1035. }
  1036. messageAppend("查找任务中");
  1037. var task = $(".task-desc:last").text();
  1038. if (task.length == 0) {
  1039. KEY.do_command("tasks");
  1040. window.setTimeout(WG.check_yamen_task, 1000);
  1041. return;
  1042. }
  1043. try {
  1044. zb_npc = task.match("犯:([^%]+),据")[1];
  1045. zb_place = task.match("在([^%]+)出")[1];
  1046. messageAppend("追捕任务:" + zb_npc + " 地点:" + zb_place);
  1047. KEY.do_command("score");
  1048. WG.go(zb_place);
  1049. window.setTimeout(WG.check_zb_npc, 1000);
  1050. } catch (error) {
  1051. messageAppend("查找衙门追捕失败");
  1052. window.setTimeout(WG.check_yamen_task, 1000);
  1053. KEY.do_command("tasks");
  1054. }
  1055. },
  1056. check_zb_npc: function () {
  1057. var lists = $(".room_items .room-item");
  1058. for (var npc of lists) {
  1059. if (npc.innerText.indexOf(zb_npc) != -1) {
  1060. WG.Send("kill " + $(npc).attr("itemid"));
  1061. messageAppend("找到" + zb_npc + ",自动击杀!!!");
  1062. return;
  1063. }
  1064. }
  1065. window.setTimeout(WG.check_zb_npc, 1000);
  1066. },
  1067.  
  1068. kill_all: function () {
  1069. var room=$(".room-name").text();
  1070. if(room=="扬州城-广场" || room== "襄阳城-广场" || room=="武道塔-入口")
  1071. return;//避免手滑送死
  1072. var lists = $(".room_items .room-item:gt(0)");
  1073. for (var npc of lists) {
  1074. WG.Send("kill " + $(npc).attr("itemid"));
  1075. }
  1076. },
  1077.  
  1078. get_all: function () {
  1079. var lists = $(".room_items .room-item:gt(0)");
  1080. for (var npc of lists) {
  1081. WG.Send("get all from " + $(npc).attr("itemid"));
  1082. }
  1083. },
  1084. clean_all: function () {
  1085. WG.go("扬州城-打铁铺");
  1086. WG.Send("sell all");
  1087. },
  1088. packup_listener: null,
  1089. sell_all: function () {
  1090. var t=$(".room-name").text();
  1091. if(t.indexOf("副本")>0)//如果在副本中停止执行
  1092. return;
  1093. if (WG.packup_listener) {
  1094. messageAppend("<hio>包裹整理</hio>运行中");
  1095. return;
  1096. }
  1097. let stores = [];
  1098. WG.packup_listener = WG.add_hook(["dialog", "text"], (data) => {
  1099. if (data.type == "dialog" && data.dialog == "list") {
  1100. if (data.stores == undefined) {
  1101. return;
  1102. }
  1103. stores = [];
  1104. //去重
  1105. for (let i = 0; i < data.stores.length; i++) {
  1106. let s = null;
  1107. for (let j = 0; j < stores.length; j++) {
  1108. if (stores[j].name == data.stores[i].name) {
  1109. s = stores[j];
  1110. break;
  1111. }
  1112. }
  1113. if (s != null) {
  1114. s.count += data.stores[i].count;
  1115. } else {
  1116. stores.push(data.stores[i]);
  1117. }
  1118. }
  1119. } else if (data.type == "dialog" && data.dialog == "pack") {
  1120. let cmds = [];
  1121. for (var i = 0; i < data.items.length; i++) {
  1122. //仓库
  1123. if (WG.inArray(data.items[i].name, store_list)) {
  1124. if (data.items[i].can_eq) {
  1125. //装备物品,不能叠加,计算总数
  1126. let store = null;
  1127. for (let j = 0; j < stores.length; j++) {
  1128. if (stores[j].name == data.items[i].name) {
  1129. store = stores[j];
  1130. break;
  1131. }
  1132. }
  1133. if (store != null) {
  1134. if (store.count < 4) {
  1135. store.count += data.items[i].count;
  1136. cmds.push("store " + data.items[i].count + " " + data.items[i].id);
  1137. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "储存到仓库");
  1138. } else {
  1139. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "超过设置的储存上限");
  1140. }
  1141. } else {
  1142. stores.push(data.items[i]);
  1143. cmds.push("store " + data.items[i].count + " " + data.items[i].id);
  1144. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "储存到仓库");
  1145. }
  1146. } else {
  1147. cmds.push("store " + data.items[i].count + " " + data.items[i].id);
  1148. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "储存到仓库");
  1149. }
  1150. }
  1151. //丢弃
  1152. if (WG.inArray(data.items[i].name, drop_list)) {
  1153. cmds.push("drop " + data.items[i].count + " " + data.items[i].id);
  1154. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "丢弃");
  1155.  
  1156. }
  1157. //分解
  1158. if (fenjie_list.length && WG.inArray(data.items[i].name, fenjie_list) && data.items[i].name.indexOf("★") == -1) {
  1159. cmds.push("fenjie " + data.items[i].id);
  1160. messageAppend("<hio>包裹整理</hio>" + data.items[i].name + "分解");
  1161.  
  1162. }
  1163. }
  1164. if (cmds.length > 0) {
  1165. WG.Send(cmds);
  1166. }
  1167. WG.go("扬州城-杂货铺");
  1168. WG.Send("sell all");
  1169. WG.Send("look3 1");
  1170. } else if (data.type == 'text' && data.msg == '没有这个玩家。') {
  1171. messageAppend("<hio>包裹整理</hio>完成");
  1172. WG.remove_hook(WG.packup_listener);
  1173. WG.packup_listener = undefined;
  1174. }
  1175. });
  1176. messageAppend("<hio>包裹整理</hio>开始");
  1177. WG.go("仓库");
  1178. WG.Send("store;pack");
  1179. },
  1180. zdwk: function () {
  1181. var t=$(".room-name").text();
  1182. if(t.indexOf("副本")>0)//如果在副本中停止执行
  1183. return;
  1184. if (G.level) {
  1185. if (G.level.indexOf('武帝') >= 0) {
  1186. WG.go("练功房");
  1187. WG.Send("xiulian");
  1188. return;
  1189. }
  1190. }
  1191. t = $(".room_items .room-item:first .item-name").text();
  1192. if( t.indexOf("<挖矿")>=0){
  1193. WG.timer_close();
  1194. return;
  1195. }
  1196. messageAppend("当前不在挖矿状态");
  1197. WG.go("扬州城-矿山");
  1198. WG.eq("铁镐");
  1199. WG.Send("wa");
  1200. timer=setTimeout(WG.zdwk, 5000);
  1201. },
  1202. timer_close: function () {
  1203. if (timer) {clearInterval(timer);timer = 0;}
  1204. },
  1205. wudao_auto: function () {
  1206. //创建定时器
  1207. if (timer == 0) { timer = setInterval(WG.wudao_auto, 2000);}
  1208. if (!WG.at("武道塔")) {
  1209. //进入武道塔
  1210. WG.go("武道塔");
  1211. WG.ask("守门人", 1);
  1212. WG.Send("go enter");
  1213. } else {
  1214. //武道塔内处理
  1215. messageAppend("武道塔");
  1216. var w = $(".room_items .room-item:last");
  1217. var t = w.text();
  1218. if (t.indexOf("守护者") != -1) {
  1219. WG.Send("kill " + w.attr("itemid"));
  1220. WG.wudao_autopfm();
  1221. } else {
  1222. WG.Send("liaoshang");
  1223. WG.Send("go up");
  1224. }
  1225. }
  1226. },
  1227. wudao_autopfm: function () {
  1228. var pfm = wudao_pfm.split(',');
  1229. for (var p of pfm) {
  1230. if ($("div.combat-panel div.combat-commands span.pfm-item:eq(" + p + ") span").css("left") == "0px")
  1231. $("div.combat-panel div.combat-commands span.pfm-item:eq(" + p + ") ").click();
  1232. }
  1233. },
  1234. xue_auto: function () {
  1235. var t = $(".room_items .room-item:first .item-name").text();
  1236. t = t.indexOf("<打坐") >0 || t.indexOf("<学习") >0 || t.indexOf("<练习") >0 || t.indexOf("<读书") >0;
  1237. //创建定时器
  1238. if (timer == 0) {
  1239. if (t == false) {
  1240. messageAppend("当前不在打坐或学技能");
  1241. return;
  1242. }
  1243. timer = setInterval(WG.xue_auto, 2000);
  1244. }
  1245. if (t == false) {
  1246. //学习状态中止,自动去挖矿
  1247. WG.timer_close();
  1248. WG.zdwk();
  1249. } else {
  1250. messageAppend("自动打坐学技能");
  1251. }
  1252. },
  1253. fbnum: 0,
  1254. needGrove: 0,
  1255. step :0,
  1256. recovery :0,
  1257. oncegrove: function () {
  1258. this.fbnum += 1;
  1259. messageAppend("第" + this.fbnum + "次");
  1260. WG.Send("cr yz/lw/shangu;cr over");
  1261. if (this.needGrove == this.fbnum) {
  1262. WG.Send("taskover signin");
  1263. messageAppend("<hiy>" + this.fbnum + "次副本小树林秒进秒退已完成</hiy>");
  1264. this.timer_close();
  1265. this.needGrove = 0;
  1266. this.fbnum = 0;
  1267. messageAppend("自动去挖矿");
  1268. setTimeout(WG.zdwk, 2000);
  1269. }
  1270. },
  1271. oncegrove2: function () {
  1272. //检查HP和MP,低于70%就恢复
  1273. var hp = $(".progress:eq(0) [style]").attr('style').match(/\d+/g)[0];
  1274. var mp = $(".progress:eq(1) [style]").attr('style').match(/\d+/g)[0];
  1275. if(hp<70 ||this.recovery=='hp' ){
  1276. WG.Send("liaoshang");
  1277. this.recovery='hp';
  1278. if(hp==100){
  1279. this.recovery=0;
  1280. }else{
  1281. messageAppend("疗伤中...");
  1282. return;
  1283. }
  1284. }
  1285. if(mp<50||this.recovery=='mp' ){
  1286. WG.Send("dazuo");
  1287. this.recovery='hp';
  1288. if(mp==100){
  1289. this.recovery=0;
  1290. WG.Send("stopstate");
  1291. }else{
  1292. messageAppend("打坐中...");
  1293. return;
  1294. }
  1295. }
  1296. var corpse=[];
  1297. var corpse2=[];
  1298. switch(this.step){
  1299. case 0:
  1300. messageAppend("第" + (this.fbnum+1 )+ "次进入流氓巷组队副本");
  1301. WG.Send("cr yz/lmw/xiangzi1 2 0");
  1302. this.step=1;
  1303. break;
  1304. case 1:
  1305. if($(".room_exits text").text()=="小巷子小巷子"){
  1306. corpse=$(".room-item").text().match(/小流氓的尸体/g);
  1307. if(corpse !=null && corpse.length==2){//是否清完第一个房间
  1308. this.get_all();
  1309. WG.Send('go east');
  1310. this.step=2;
  1311. }else this.kill_all();
  1312. }
  1313. break;
  1314. case 2:
  1315. if($(".room_exits text").text()==="小巷子小巷子破茅屋巷子深处"){
  1316. corpse=$(".room-item").text().match(/流氓的尸体/g);
  1317. if(corpse !==null && corpse.length==2){//是否清完第二个房间
  1318. this.get_all();
  1319. WG.Send('go north');
  1320. this.step=3;
  1321. }else this.kill_all();
  1322. }
  1323. break;
  1324. case 3:
  1325. if($(".room_exits text").text()=="破茅屋小巷子"){
  1326. corpse=$(".room-item").text().match(/流氓头的尸体/g);
  1327. corpse2=$(".room-item").text().match(/流氓的尸体/g);
  1328. if(corpse !==null && corpse2 !=null && corpse.length==1 && corpse2.length==2){//是否清完第三个房间
  1329. this.get_all();
  1330. WG.Send('go south;go east');
  1331. this.step=4;
  1332. }else this.kill_all();
  1333. }
  1334. break;
  1335. case 4:
  1336. if( $(".room_exits text").text()=="巷子深处小巷子头目房间"){
  1337. corpse=$(".room-item").text().match(/流氓的尸体/g);
  1338. if(corpse !==null && corpse.length==2){//是否清完第四个房间
  1339. this.get_all();
  1340. WG.Send('go east');
  1341. this.step=5;
  1342. }else this.kill_all();
  1343. }
  1344. break;
  1345. case 5:
  1346. if($ (".room_exits text").text()=="头目房间巷子深处"){
  1347. corpse=$(".room-item").text().match(/赵三拳的尸体/g);
  1348. if(corpse !=null && corpse.length==1){//是否清完第五个房间
  1349. this.get_all();
  1350. WG.Send('cr over');
  1351. this.step=0;
  1352. this.fbnum+=1;
  1353. messageAppend("流氓巷组队副本完成第:"+this.fbnum+"/"+this.needGrove);
  1354. //打开一次背包检查背包空格,小于5格就自动售卖
  1355. KEY.do_command("pack");
  1356. var inums=$(".dialog-title").text().match(/\w+/g);
  1357. if(inums[1]-inums[0]<5){
  1358. messageAppend("背包剩下"+(inums[1]-inums[0])+"个空格,自动售卖垃圾。");
  1359. this.sell_all();
  1360. }else{messageAppend("背包还有"+(inums[1]-inums[0])+"个空格。");}
  1361. KEY.dialog_close();
  1362. }else this.kill_all();
  1363. }
  1364. break;
  1365. }
  1366. if (this.needGrove == this.fbnum) {
  1367. WG.Send("taskover signin");
  1368. messageAppend("<hiy>" + this.fbnum + "次流氓巷组队副本已完成</hiy>");
  1369. this.timer_close();
  1370. this.needGrove = 0;
  1371. this.fbnum = 0;
  1372. messageAppend("自动去挖矿");
  1373. setTimeout(WG.zdwk, 2000);
  1374. }
  1375. },
  1376. grove_ask_info: function () {
  1377. return prompt("请输入需要秒进秒退的副本次数", "");
  1378. },
  1379. grove_auto: function () {
  1380. if (timer == 0) {
  1381. this.needGrove = this.grove_ask_info();
  1382. if (this.needGrove) //如果返回的有内容
  1383. {
  1384. if (parseFloat(this.needGrove).toString() == "NaN") {
  1385. messageAppend("请输入数字");
  1386. return;
  1387. }
  1388. messageAppend("开始秒进秒退小树林" + this.needGrove + "次");
  1389.  
  1390. timer = setInterval(() => {
  1391. this.oncegrove()
  1392. }, 1000);
  1393. }
  1394. }
  1395. },
  1396. grove_auto2: function () {//自动流氓巷
  1397. if (timer == 0) {
  1398. this.needGrove = this.grove_ask_info();
  1399. if (this.needGrove) //如果返回的有内容
  1400. {
  1401. if (parseFloat(this.needGrove).toString() == "NaN") {
  1402. messageAppend("请输入数字");
  1403. return;
  1404. }
  1405. messageAppend("开始流氓巷(组队)" + this.needGrove + "次");
  1406. this.step=0;
  1407. timer = setInterval(() => {
  1408. this.oncegrove2()
  1409. }, 1500);
  1410. }
  1411. }
  1412. },
  1413. showhideborad: function () {
  1414. if ($('.WG_log').css('display') == 'none') {
  1415. $('.WG_log').show();
  1416. } else {
  1417. $('.WG_log').hide();
  1418. }
  1419. },
  1420. calc: function () {
  1421. messageClear();
  1422. var html = `
  1423. <div>
  1424. <div style="width:50%;float:left">
  1425. <span>潜能计算器</span>
  1426. <input type="number" id="c" placeholder="初始等级" style="width:50%" class="mui-input-speech"><br/>
  1427. <input type="number" id="m" placeholder="目标等级" style="width:50%"><br/>
  1428. <select id="se" style="width:50%">
  1429. <option value='0'>选择技能颜色</option>
  1430. <option value='1' style="color: #c0c0c0;">白色</option>
  1431. <option value='2' style="color:#00ff00;">绿色</option>
  1432. <option value='3' style="color:#00ffff;">蓝色</option>
  1433. <option value='4' style="color:#ffff00;">黄色</option>
  1434. <option value='5' style="color:#912cee;">紫色</option>
  1435. <option value='6' style="color: #ffa600;">橙色</option>
  1436. </select><br/>
  1437. <input type="button" value="计算" style="width:50%" id="qnjs"><br/>
  1438. </div>
  1439. <div style="width:50%;float:left">
  1440. <span>开花计算器</span>
  1441. <input type="number" id="nl" placeholder="当前内力" style="width:50%" class="mui-input-speech"><br/>
  1442. <input type="number" id="xg" placeholder="先天根骨" style="width:50%"><br/>
  1443. <input type="number" id="hg" placeholder="后天根骨" style="width:50%"><br/>
  1444. <input type="button" value="计算" id = "kaihua" style="width:50%" <br/>
  1445. <label>人花分值:5000 地花分值:6500 天花分值:8000</label>
  1446. </div>
  1447.  
  1448. </div>`;
  1449. messageAppend(html);
  1450. $("#qnjs").on('click', function () {
  1451. messageAppend("需要潜能:" + Helper.dian(Number($("#c").val()), Number($("#m").val()), Number($("#se").val())));
  1452. });
  1453. $("#kaihua").on('click', function () {
  1454. messageAppend("你的分值:" + Helper.gen(Number($("#nl").val()), Number($("#xg").val()), Number($("#hg").val())));
  1455. });
  1456. },
  1457. setting: function () {
  1458. messageClear();
  1459. var a = `<div style='text-align:right;width:280px'>
  1460. 有空的话请点个star,您的支持是我最大的动力<a target="_blank" href="https://github.com/knva/wsmud_plugins">https://github.com/knva/wsmud_plugins</a>
  1461. <span>
  1462. <label for="family">门派选择:</label><select style='width:80px' id="family">
  1463. <option value="武当">武当</option>
  1464. <option value="华山">华山</option>
  1465. <option value="少林">少林</option>
  1466. <option value="峨眉">峨眉</option>
  1467. <option value="逍遥">逍遥</option>
  1468. <option value="丐帮">丐帮</option>
  1469. <option value="武馆">武馆</option>
  1470. </select>
  1471. </span>
  1472. <span><label for="sm_loser">师门自动放弃: </label><select style='width:80px' id = "sm_loser">
  1473. <option value="已停止">已停止</option>
  1474. <option value="已开启">已开启</option>
  1475. </select>
  1476. </span>
  1477. <span><label for="wudao_pfm">武道自动攻击: </label><input style='width:80px' type="text" id="wudao_pfm" name="wudao_pfm" value="">
  1478. </span>
  1479. <span><label for="marry_kiss">自动喜宴: </label><select style='width:80px' id = "marry_kiss">
  1480. <option value="已停止">已停止</option>
  1481. <option value="已开启">已开启</option>
  1482. </select>
  1483. </span>
  1484. <span><label for="ks_Boss">自动传到boss </label><select style='width:80px' id = "ks_Boss">
  1485. <option value="已停止">已停止</option>
  1486. <option value="已开启">已开启</option>
  1487. </select>
  1488. </span>
  1489. <span><label for="show_hp">全局显血: </label><select style='width:80px' id = "show_hp">
  1490. <option value="已停止">已停止</option>
  1491. <option value="已开启">已开启</option>
  1492. </select>
  1493. </span>
  1494. </span>
  1495. <span><label for="auto_eq">BOSS击杀时自动换装: </label><select style='width:80px' id = "auto_eq">
  1496. <option value="0">已停止</option>
  1497. <option value="1">套装1</option>
  1498. <option value="2">套装2</option>
  1499. <option value="3">套装3</option>
  1500. </select>
  1501. </span>
  1502. <span><label for="ks_pfm">叫杀延时(ms): </label><input style='width:80px' type="text" id="ks_pfm" name="ks_pfm" value="">
  1503. </span>
  1504. <span> <label for = "autopfmswitch" > 自动施法开关: </label><select style = 'width:80px' id = "autopfmswitch" >
  1505. <option value = "已停止" > 已停止 </option>
  1506. <option value = "已开启" > 已开启 </option>
  1507. </select>
  1508. </span>
  1509. <span><label for = "unautopfm" > 自动施法黑名单: </label><input style='width:80px' type="text" id="unauto_pfm" name="unauto_pfm" value="">
  1510. </span>
  1511. <div class="item-commands"><span class="updete_id_all">初始化ID</span></div>
  1512. </div>
  1513. `;
  1514. messageAppend(a);
  1515. $('#family').val(family);
  1516. $("#family").change(function () {
  1517. family = $("#family").val();
  1518. GM_setValue(role + "_family", family);
  1519. });
  1520. $('#wudao_pfm').val(wudao_pfm);
  1521. $('#wudao_pfm').focusout(function () {
  1522. wudao_pfm = $('#wudao_pfm').val();
  1523. GM_setValue(role + "_wudao_pfm", wudao_pfm);
  1524. });
  1525. $('#sm_loser').val(sm_loser);
  1526. $('#sm_loser').focusout(function () {
  1527. sm_loser = $('#sm_loser').val();
  1528. GM_setValue(role + "_sm_loser", sm_loser);
  1529. });
  1530. $('#ks_pfm').val(ks_pfm);
  1531. $('#ks_pfm').focusout(function () {
  1532. ks_pfm = $('#ks_pfm').val();
  1533. GM_setValue(role + "_ks_pfm", ks_pfm);
  1534. });
  1535. $('#marry_kiss').val(automarry);
  1536. $('#marry_kiss').change(function () {
  1537. automarry = $('#marry_kiss').val();
  1538. GM_setValue(role + "_automarry", automarry);
  1539. });
  1540. $('#ks_Boss').val(autoKsBoss);
  1541. $('#ks_Boss').change(function () {
  1542. autoKsBoss = $('#ks_Boss').val();
  1543. GM_setValue(role + "_autoKsBoss", autoKsBoss);
  1544. });
  1545. $('#show_hp').val(showHP);
  1546. $('#show_hp').change(function () {
  1547. showHP = $('#show_hp').val();
  1548. GM_setValue(role + "_showHP", showHP);
  1549. Helper.showallhp();
  1550. });
  1551. $('#auto_eq').val(autoeq);
  1552. $('#auto_eq').change(function () {
  1553. autoeq = $('#auto_eq').val();
  1554. GM_setValue(role + "_auto_eq", autoeq);
  1555.  
  1556. });
  1557. $('#autopfmswitch').val(auto_pfmswitch);
  1558. $('#autopfmswitch').change(function () {
  1559. auto_pfmswitch = $('#autopfmswitch').val();
  1560. GM_setValue(role + "_auto_pfmswitch", auto_pfmswitch);
  1561. if (auto_pfmswitch == '已开启') {
  1562. G.auto_preform = true;
  1563. }else{
  1564. G.auto_preform = false;
  1565. }
  1566. });
  1567. $('#unauto_pfm').val(unauto_pfm);
  1568. $('#unauto_pfm').change(function () {
  1569. unauto_pfm = $('#unauto_pfm').val();
  1570. GM_setValue(role + "_unauto_pfm", unauto_pfm);
  1571. messageAppend('修改后请刷新');
  1572. });
  1573. $(".updete_id_all").on("click", WG.updete_id_all);
  1574. },
  1575. hooks: [],
  1576. hook_index: 0,
  1577. add_hook: function (types, fn) {
  1578. var hook = {
  1579. 'index': WG.hook_index++,
  1580. 'types': types,
  1581. 'fn': fn
  1582. };
  1583. WG.hooks.push(hook);
  1584. return hook.index;
  1585. },
  1586. remove_hook: function (hookindex) {
  1587. var that = this;
  1588. console.log("remove_hook");
  1589. for (var i = 0; i < that.hooks.length; i++) {
  1590. if (that.hooks[i].index == hookindex) {
  1591. that.hooks.baoremove(i);
  1592. }
  1593. }
  1594. },
  1595. run_hook: function (type, data) {
  1596. //console.log(data);
  1597. for (var i = 0; i < this.hooks.length; i++) {
  1598. // if (this.hooks[i] !== undefined && this.hooks[i].type == type) {
  1599. // this.hooks[i].fn(data);
  1600. // }
  1601. var listener = this.hooks[i];
  1602. if (listener.types == data.type || (listener.types instanceof Array && $
  1603. .inArray(data.type, listener.types) >= 0)) {
  1604. listener.fn(data);
  1605. }
  1606. }
  1607. },
  1608. receive_message: function (msg) {
  1609. ws_on_message.apply(this, arguments);
  1610. if (!msg || !msg.data) return;
  1611. var data;
  1612. if (msg.data[0] == '{' || msg.data[0] == '[') {
  1613. var func = new Function("return " + msg.data + ";");
  1614. data = func();
  1615. } else {
  1616. data = {
  1617. type: 'text',
  1618. msg: msg.data
  1619. };
  1620. }
  1621. WG.run_hook(data.type, data);
  1622. },
  1623. auto_preform_switch: function () {
  1624.  
  1625. if (G.auto_preform) {
  1626. G.auto_preform = false;
  1627. messageAppend("<hio>自动施法</hio>关闭");
  1628. WG.auto_preform("stop");
  1629. } else {
  1630. G.auto_preform = true;
  1631. messageAppend("<hio>自动施法</hio>开启");
  1632. WG.auto_preform();
  1633. }
  1634. },
  1635. auto_preform: function (v) {
  1636.  
  1637. if (v == "stop") {
  1638. if (G.preform_timer) {
  1639. clearInterval(G.preform_timer);
  1640. G.preform_timer = undefined;
  1641. $(".auto_perform").css("background", "");
  1642. }
  1643. return;
  1644. }
  1645. if (G.preform_timer || G.auto_preform == false) return;
  1646. $(".auto_perform").css("background", "#3E0000");
  1647. G.preform_timer = setInterval(() => {
  1648. if (G.in_fight == false) WG.auto_preform("stop");
  1649. for (var skill of G.skills) {
  1650. if (WG.inArray(skill.id, blackpfm)) {
  1651. continue;
  1652. }
  1653. if (!G.gcd && !G.cds.get(skill.id)) {
  1654. WG.Send("perform " + skill.id);
  1655. break;
  1656. }
  1657. }
  1658. }, 350);
  1659. },
  1660. };
  1661. var Helper = {
  1662. formatCurrencyTenThou: function (num) {
  1663. num = num.toString().replace(/\$|\,/g, '');
  1664. if (isNaN(num)) num = "0";
  1665. var sign = (num == (num = Math.abs(num)));
  1666. num = Math.floor(num * 10 + 0.50000000001); //cents = num%10;
  1667. num = Math.floor(num / 10).toString();
  1668. for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
  1669. num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
  1670. }
  1671. return (((sign) ? '' : '-') + num);
  1672. },
  1673. gen: function (nl, xg, hg) {
  1674. var jg = nl / 100 + xg * hg / 10;
  1675. var sd = this.formatCurrencyTenThou(jg);
  1676. return sd;
  1677. },
  1678. dian: function (c, m, se) {
  1679. var j = c + m;
  1680. var jj = m - c;
  1681. var jjc = jj / 2;
  1682. var z = j * jjc * se * 5;
  1683. var sd = this.formatCurrencyTenThou(z);
  1684. return sd;
  1685. },
  1686. //找boss,boss不在,-1,
  1687. findboss: function (data, bossname, callback) {
  1688. for (let i = 0; i < data.items.length; i++) {
  1689. if (data.items[i] != 0) {
  1690. if (data.items[i].name.indexOf(bossname) >= 0) {
  1691. callback(data.items[i].id);
  1692. }
  1693. }
  1694. }
  1695. callback(-1);
  1696. },
  1697. ksboss: '',
  1698. marryhy: '',
  1699. kksBoss: function (data) {
  1700. var boss_place = boss_place = data.content.match("出现在([^%]+)一带。");
  1701. var boss_name = data.content.match("听说([^%]+)出现在");
  1702. if (boss_name == null || boss_place == null) {
  1703. return;
  1704. }
  1705. if (WG.inArray(boss_name, blacklist)) {
  1706. messageAppend("黑名单boss,忽略!");
  1707. return;
  1708. }
  1709. boss_name = data.content.match("听说([^%]+)出现在")[1];
  1710. boss_place = data.content.match("出现在([^%]+)一带。")[1];
  1711. var autoKsBoss = GM_getValue(role + "_autoKsBoss", autoKsBoss);
  1712. var ks_pfm_p = GM_getValue(role + "_ks_pfm", ks_pfm);
  1713. var autoeq = GM_getValue(role + "_auto_eq", autoeq);
  1714. console.log("boss");
  1715. console.log(boss_place);
  1716. messageAppend("自动前往BOSS地点");
  1717. WG.Send("stopstate");
  1718. WG.go(boss_place);
  1719. this.ksboss = WG.add_hook(["items", "itemadd", "die"], function (data) {
  1720. if (data.type == "items") {
  1721. if (!WG.at(boss_place)) {return;}
  1722. Helper.findboss(data, boss_name, function (bid) {
  1723. if (bid != -1) {
  1724. next = 999;
  1725. Helper.eqhelper(autoeq);
  1726. setTimeout(() => {
  1727. WG.Send("kill " + bid);
  1728. //WG.Send("select " + bid);
  1729. next = 0;
  1730. }, Number(ks_pfm_p));
  1731. } else {
  1732. if (next == 999) {
  1733. console.log('found');
  1734. return;
  1735. }
  1736. let lj = needfind[boss_place];
  1737. if (needfind[boss_place] != undefined && next < lj.length) {
  1738. setTimeout(() => {
  1739. console.log(lj[next]);
  1740. WG.Send(lj[next]);
  1741. next++;
  1742. }, 1000);
  1743. } else {
  1744. console.log("not found");
  1745. }
  1746. }
  1747. });
  1748. }
  1749. if (data.type == "itemadd") {
  1750. if (data.name.indexOf(boss_name) >= 0) {
  1751. next = 0;
  1752. WG.get_all();
  1753. WG.remove_hook(this.index);
  1754. }
  1755. }
  1756. if (data.type == "die") {
  1757. next = 0;
  1758. WG.Send('relive');
  1759. WG.remove_hook(this.index);
  1760. }
  1761. });
  1762. setTimeout(() => {
  1763. console.log("复活挖矿");
  1764. WG.Send('relive');
  1765. WG.remove_hook(this.ksboss);
  1766. WG.zdwk();
  1767. next = 0;
  1768. }, 60000);
  1769. },
  1770. xiyan: function () {
  1771. WG.Send("stopstate");
  1772. WG.go("扬州城-喜宴");
  1773. this.marryhy = WG.add_hook(['items', 'cmds', 'text', 'msg'], function (data) {
  1774.  
  1775. if (data.type == 'items') {
  1776.  
  1777. for (let idx = 0; idx < data.items.length; idx++) {
  1778. if (data.items[idx] != 0) {
  1779. if (data.items[idx].name.indexOf(">婚宴礼桌<") >= 0) {
  1780. console.log("拾取");
  1781. WG.Send('get all from ' + data.items[idx].id);
  1782. console.log("xy" + this.index);
  1783. WG.remove_hook(this.index);
  1784.  
  1785. break;
  1786. }
  1787. }
  1788. }
  1789. } else if (data.type == 'text') {
  1790. if (data.msg == "你要给谁东西?") {
  1791. console.log("没人");
  1792. }
  1793. if (/^店小二拦住你说道:怎么又是你,每次都跑这么快,等下再进去。$/.test(data.msg)) {
  1794. console.log("cd");
  1795. messageAppend("<hiy>你太勤快了, 1秒后回去挖矿</hiy>")
  1796. }
  1797. if (/^店小二拦住你说道:这位(.+),不好意思,婚宴宾客已经太多了。$/.test(data.msg)) {
  1798. console.log("客满");
  1799. messageAppend("<hiy>你来太晚了, 1秒后回去挖矿</hiy>")
  1800.  
  1801. }
  1802. } else if (data.type == 'cmds') {
  1803.  
  1804. for (let idx = 0; idx < data.items.length; idx++) {
  1805. if (data.items[idx].name == '1金贺礼') {
  1806. WG.Send(data.items[idx].cmd + ';go up');
  1807. console.log("交钱");
  1808. break;
  1809. }
  1810. }
  1811. }
  1812. });
  1813. setTimeout(() => {
  1814. console.log("挖矿");
  1815. WG.remove_hook(this.marryhy);
  1816. WG.zdwk();
  1817. next = 0;
  1818. }, 30000);
  1819. },
  1820. showhp(id) {
  1821. let re = '';
  1822. for (let i = 0; i < roomData.length; i++) {
  1823. if (roomData[i] != 0) {
  1824. if (roomData[i].id == id) {
  1825. re = "角色名:" + roomData[i].name + "\n";
  1826. re += "血量:" + roomData[i].hp + "/" + roomData[i].max_hp + "\n";
  1827. re += "蓝量:" + roomData[i].mp + "/" + roomData[i].max_mp;
  1828. return re;
  1829. }
  1830. }
  1831. }
  1832. return '';
  1833. },
  1834. saveRoomstate(data) {
  1835. roomData = data.items;
  1836. },
  1837. showallhp() {
  1838. var myshow = GM_getValue(role + "_showHP", showHP);
  1839. if (myshow == "已开启") {
  1840. roomData.forEach(function (v, k) {
  1841. if (v != 0) {
  1842. if (v.hp) {
  1843. $(".item-plushp[itemid=" + v.id + "]").remove();
  1844. $("[itemid=" + v.id + "] .item-status").after("<span class='item-plushp' itemid='" + v.id + "'></span>").next();
  1845. $(".item-plushp[itemid=" + v.id + "]").html("<hig>hp:" + v.hp + "(" + Math.floor(v.hp / v.max_hp * 100) + "%)</hig>");
  1846. }
  1847. }
  1848. });
  1849. } else if (myshow == "已停止") {
  1850. $(".plushp").remove();
  1851. }
  1852. },
  1853. eqx: null,
  1854. eqhelper(type) {
  1855. if (type == undefined || type == 0 || type > eqlist.length) {
  1856. return;
  1857. }
  1858. if (eqlist == null || eqlist[type] == "") {
  1859. messageAppend("套装未保存,保存当前装备作为套装" + type + "!", 1);
  1860. this.eqx = WG.add_hook("dialog", (data) => {
  1861. if (data.dialog == "pack" && data.eqs != undefined) {
  1862. eqlist[type] = data.eqs;
  1863. GM_setValue(role + "_eqlist", eqlist);
  1864. messageAppend("套装" + type + "保存成功!", 1);
  1865. WG.remove_hook(this.eqx);
  1866. }
  1867. });
  1868. WG.Send("pack");
  1869. } else {
  1870. eqlist = GM_getValue(role + "_eqlist", eqlist);
  1871. for (let i = 1; i < eqlist[type].length; i++) {
  1872. if (eqlist[type][i] != null) {
  1873.  
  1874. WG.Send("eq " + eqlist[type][i].id);
  1875. }
  1876. }
  1877. if (eqlist[type][0] != null) {
  1878. WG.Send("eq " + eqlist[type][0].id);
  1879. }
  1880. messageAppend("套装装备成功" + type + "!", 1);
  1881. }
  1882. },
  1883. eqhelperdel: function (type) {
  1884. eqlist = GM_getValue(role + "_eqlist", eqlist);
  1885. eqlist[type] = [];
  1886. GM_setValue(role + "_eqlist", eqlist);
  1887. messageAppend("清除套装" + type + "设置成功!", 1);
  1888. },
  1889. uneqall: function () {
  1890. this.eqx = WG.add_hook("dialog", (data) => {
  1891. if (data.dialog == "pack" && data.eqs != undefined) {
  1892. for (let i = 0; i < data.eqs.length; i++) {
  1893. if (data.eqs[i] != null) {
  1894. WG.Send("uneq " + data.eqs[i].id);
  1895. }
  1896. }
  1897. WG.remove_hook(this.eqx);
  1898. }
  1899. });
  1900. WG.Send("pack");
  1901. messageAppend("取消所有装备成功!", 1);
  1902. },
  1903. show_DPS: function (id, item) {
  1904. let s = $(".room-item[itemid=" + id + "] .item-dps");
  1905. if (s.length == 0) {
  1906. s = $(".room-item[itemid=" + id + "] .item-status").after("<span class='item-dps'></span>").next();
  1907. }
  1908. let html = "";
  1909. if (item.damage) html = "<hir>" + item.damage + "(" + Math.floor(item.damage / item.max_hp * 100) + "%)</hir>";
  1910. s.html(html);
  1911. },
  1912. fight_listener: undefined,
  1913. auto_fight: function () {
  1914.  
  1915. if (Helper.fight_listener) {
  1916. messageAppend("<hio>自动比试</hio>结束");
  1917. WG.remove_hook(Helper.fight_listener);
  1918. Helper.fight_listener = undefined;
  1919. return;
  1920. }
  1921. let name = prompt("请输入NPC名称,例如:\"高根明\"");
  1922. let id = Helper.find_item(name);
  1923. if (id == null) return;
  1924. Helper.fight_listener = WG.add_hook(["sc", "combat"], function (data) {
  1925. if (data.type == "combat" && data.end) {
  1926. Helper.recover(1, 1, 0, function () {});
  1927. } else if (data.type == "sc" && data.id == id) {
  1928. let item = G.items.get(id);
  1929. if (item.hp >= item.max_hp) {
  1930. Helper.recover(1, 1, 0, function () {
  1931. WG.Send("stopstate;fight " + id);
  1932. });
  1933. }
  1934. }
  1935.  
  1936. });
  1937. WG.Send("stopstate;fight " + id);
  1938. messageAppend("<hio>自动比试</hio>开始");
  1939. },
  1940. find_item: function (name) {
  1941. for (let [k, v] of G.items) {
  1942. if (v.name == name) {
  1943. return k;
  1944. }
  1945. }
  1946. return null;
  1947. },
  1948. recover: function (hp, mp, cd, callback) {
  1949. //返回定时器
  1950. if (hp == 0) {
  1951. if (WG.recover_timer) {
  1952. clearTimeout(WG.recover_timer);
  1953. WG.recover_timer = undefined;
  1954. }
  1955. return;
  1956. }
  1957. WG.Send("dazuo");
  1958. WG.recover_timer = setInterval(function () {
  1959. //检查状态
  1960. let item = G.items.get(G.id);
  1961. if (item.mp / item.max_mp < mp) { //内力控制
  1962. if (item.state != "打坐") {
  1963. WG.Send("stopstate;dazuo");
  1964. }
  1965. return;
  1966. }
  1967. if (item.hp / item.max_hp < hp) {
  1968. //血满
  1969. if (item.state != "疗伤") {
  1970. WG.Send("stopstate;liaoshang");
  1971. }
  1972. return;
  1973. }
  1974. if (item.state) WG.Send("stopstate");
  1975. if (cd) {
  1976. for (let [k, v] of G.cds) {
  1977. if (k == "force.tu") continue;
  1978. if (v) return;
  1979. }
  1980. }
  1981. clearInterval(WG.recover_timer);
  1982. callback();
  1983. }, 1000);
  1984. },
  1985. useitem_hook: undefined,
  1986. auto_useitem: async function () {
  1987. var useflag = true;
  1988. if (!Helper.useitem_hook) {
  1989. Helper.useitem_hook = WG.add_hook("text", function (data) {
  1990. if (data.msg.indexOf("你身上没有这个东西") >= 0 || data.msg.indexOf("太多") >= 0 || data.msg.indexOf("不能使用") >= 0) {
  1991. useflag = false;
  1992. WG.remove_hook(Helper.useitem_hook);
  1993. Helper.useitem_hook = undefined;
  1994. }
  1995. })
  1996. }
  1997. let name = prompt("请输入物品id,在背包中点击查看物品,即可在提示窗口看到物品id输出");
  1998. if(!name){
  1999. WG.remove_hook(Helper.useitem_hook);
  2000. Helper.useitem_hook = undefined;
  2001. return;
  2002. }
  2003. let num = prompt("请输入物品使用次数,例如:\"10\"", '10');
  2004. if (name) {
  2005. if (name.length != 11) {
  2006. alert('id不合法');
  2007. WG.remove_hook(Helper.useitem_hook);
  2008. Helper.useitem_hook = undefined;
  2009. return;
  2010. }
  2011. for (var i = 0; i < num; i++) {
  2012. if (useflag) {
  2013. WG.Send('use ' + name);
  2014. await WG.sleep(1000);
  2015. } else {
  2016. WG.remove_hook(Helper.useitem_hook);
  2017. Helper.useitem_hook = undefined;
  2018. return;
  2019. }
  2020. }
  2021. }
  2022. WG.remove_hook(Helper.useitem_hook);
  2023. Helper.useitem_hook = undefined;
  2024. }
  2025. };
  2026. //全局变量
  2027. var G = {
  2028. id: undefined,
  2029. state: undefined,
  2030. room_name: undefined,
  2031. family: undefined,
  2032. items: new Map(),
  2033. stat_boss_success: 0,
  2034. stat_boss_find: 0,
  2035. stat_xiyan_success: 0,
  2036. stat_xiyan_find: 0,
  2037. cds: new Map(),
  2038. in_fight: false,
  2039. auto_preform: false,
  2040. can_auto: false,
  2041. level: undefined,
  2042. };
  2043. $(document).ready(function () {
  2044. $('head').append('<link href="https://s1.pstatp.com/cdn/expire-1-y/jquery-contextmenu/2.6.3/jquery.contextMenu.min.css" rel="stylesheet">');
  2045. KEY.init();
  2046. WG.init();
  2047. WG.add_hook("items", function (data) {
  2048. Helper.saveRoomstate(data);
  2049. Helper.showallhp();
  2050. });
  2051. WG.add_hook("sc", function (data) {
  2052. if ("hp" in data) {
  2053. roomData.forEach(function (v, k) {
  2054. if (v.id == data.id) {
  2055. v.hp = data.hp;
  2056. }
  2057. });
  2058. Helper.showallhp();
  2059. }
  2060. });
  2061. WG.add_hook("itemadd", function (data) {
  2062. roomData.push(data);
  2063. Helper.showallhp();
  2064. });
  2065. WG.add_hook("itemremove", function (data) {
  2066. roomData.forEach(function (v, k) {
  2067. if (v.id == data.id) {
  2068. $(".plushp[itemid=" + v.id + "]").remove();
  2069. roomData.splice(k, 1);
  2070. }
  2071. });
  2072. Helper.showallhp();
  2073. });
  2074. WG.add_hook(["login", "room", "items", "itemadd", "itemremove", "sc", "text", "state", "msg", "perform", "dispfm", "combat"], function (data) {
  2075. if (data.type == "login") {
  2076. G.id = data.id;
  2077. } else if (data.type == "room") {
  2078. let tmp = data.path.split("/");
  2079. G.map = tmp[0];
  2080. G.room = tmp[1];
  2081. if (G.map == 'home' || G.room == 'kuang')
  2082. G.can_auto = true;
  2083. else
  2084. G.can_auto = false;
  2085.  
  2086. G.room_name = data.name;
  2087. } else if (data.type == "items") {
  2088. G.items = new Map();
  2089. for (var i = 0; i < data.items.length; i++) {
  2090. let item = data.items[i];
  2091. if (item.id) {
  2092. let n = $.trim($('<body>' + item.name + '</body>').text());
  2093. let i = n.lastIndexOf(' ');
  2094. let j = n.lastIndexOf('<');
  2095. let t = "";
  2096. let s = "";
  2097. if (j >= 0) {
  2098. s = n.substr(j + 1, 2);
  2099. }
  2100. if (i >= 0) {
  2101. t = n.substr(0, i);
  2102. n = n.substr(i + 1).replace(/<.*>/g, '');
  2103. }
  2104.  
  2105. G.items.set(item.id, {
  2106. name: n,
  2107. title: t,
  2108. state: s,
  2109. max_hp: item.max_hp,
  2110. max_mp: item.max_mp,
  2111. hp: item.hp,
  2112. mp: item.mp,
  2113. p: item.p,
  2114. damage: 0
  2115. });
  2116. }
  2117.  
  2118. }
  2119. } else if (data.type == "itemadd") {
  2120. if (data.id) {
  2121. let n = $.trim($('<body>' + data.name + '</body>').text());
  2122. let i = n.lastIndexOf(' ');
  2123. let j = n.lastIndexOf('<');
  2124. let t = "";
  2125. let s = "";
  2126. if (i >= 0) {
  2127. t = n.substr(0, i);
  2128. if (j >= 0) {
  2129. s = n.substr(j + 1, 2);
  2130. }
  2131. n = n.substr(i + 1).replace(/<.*>/g, '');
  2132. }
  2133. G.items.set(data.id, {
  2134. name: n,
  2135. title: t,
  2136. state: s,
  2137. max_hp: data.max_hp,
  2138. max_mp: data.max_mp,
  2139. hp: data.hp,
  2140. mp: data.mp,
  2141. p: data.p,
  2142. damage: 0
  2143. });
  2144. }
  2145. } else if (data.type == "itemremove") {
  2146. G.items.delete(data.id);
  2147. } else if (data.type == "sc") {
  2148. let item = G.items.get(data.id);
  2149. if (data.hp !== undefined) {
  2150. item.hp = data.hp;
  2151. if (data.id != G.id) {
  2152. G.scid = data.id; //伤害统计需要
  2153. }
  2154. Helper.showallhp();
  2155. }
  2156. if (data.mp !== undefined) {
  2157. item.mp = data.mp;
  2158. }
  2159. } else if (data.type == "text") {
  2160. if (G.in_fight) {
  2161. let dps_index1 = data.msg.indexOf("造成");
  2162. if (dps_index1 >= 0) {
  2163. let dps_index2 = data.msg.indexOf("/", dps_index1);
  2164. let item = G.items.get(G.scid);
  2165. if (item) {
  2166. item.damage += parseInt(data.msg.slice(dps_index1 + 7, dps_index2 - 1));
  2167. Helper.show_DPS(G.scid, item);
  2168. }
  2169. }
  2170. }
  2171. } else if (data.type == "perform") {
  2172. G.skills = data.skills;
  2173. } else if (data.type == 'dispfm') {
  2174. if (data.id) {
  2175. if (data.distime) {}
  2176. G.cds.set(data.id, true);
  2177. var _id = data.id;
  2178. setTimeout(function () {
  2179. G.cds.set(_id, false);
  2180. }, data.distime);
  2181. }
  2182. if (data.rtime) {
  2183. G.gcd = true;
  2184. setTimeout(function () {
  2185. G.gcd = false;
  2186. }, data.rtime);
  2187. } else {
  2188. G.gcd = false;
  2189. }
  2190.  
  2191.  
  2192. } else if (data.type == "combat") {
  2193. if (data.start) {
  2194. G.in_fight = true;
  2195. WG.auto_preform();
  2196. }
  2197. if (data.end) {
  2198. G.in_fight = false;
  2199. WG.auto_preform("stop");
  2200. }
  2201. }
  2202. });
  2203.  
  2204. WG.add_hook("item", function (data) {
  2205. if (data.id != null) {
  2206. messageAppend(Helper.showhp(data.id));
  2207. }
  2208. });
  2209. WG.add_hook("state", function (data) {
  2210. console.dir(data);
  2211. });
  2212. WG.add_hook("dialog", function (data) {
  2213. //console.dir(data);
  2214. if (data.dialog == "pack" && data.items != undefined && data.items.length >= 0) {
  2215. //equip =
  2216. for (var i = 0; i < data.items.length; i++) {
  2217. if (data.items[i].name.indexOf("铁镐") >= 0) {
  2218. equip["铁镐"] = data.items[i].id;
  2219. //messageAppend("铁镐ID:" + data.items[i].id);
  2220. }
  2221. }
  2222. for (var j = 0; j < data.eqs.length; j++) {
  2223. if (data.eqs[j] != null && data.eqs[j].name.indexOf("铁镐") >= 0) {
  2224. equip["铁镐"] = data.eqs[j].id;
  2225. //messageAppend("铁镐ID:" + data.eqs[j].id);
  2226. }
  2227. }
  2228. } else if (data.dialog == 'pack' && data.desc != undefined) {
  2229. messageClear();
  2230. var itemname = data.desc.split("\n")[0];
  2231. var htmla = `<div class="item-commands ">
  2232. <span class = "copyid" data-clipboard-target = ".target1" > `+itemname+":"+data.id+
  2233. `复制到剪贴板 </span></div> `;
  2234. messageAppend(htmla);
  2235. $(".copyid").on('click',()=>{
  2236. var copydata = data.id;
  2237. GM_setClipboard(copydata);
  2238. messageAppend("复制成功");
  2239. });
  2240.  
  2241. }
  2242. if (data.dialog == 'score') {
  2243. if (!G.level){
  2244. G.level = data.level;
  2245. console.log("欢迎" + G.level);
  2246. }
  2247. }
  2248. });
  2249. WG.add_hook("msg", function (data) {
  2250. if (data.ch == "sys") {
  2251. var automarry = GM_getValue(role + "_automarry", automarry);
  2252. if (data.content.indexOf(",婚礼将在一分钟后开始。") >= 0) {
  2253. console.dir(data);
  2254. if (automarry == "已开启") {
  2255. console.log("xiyan");
  2256. messageAppend("自动前往婚宴地点")
  2257. Helper.xiyan();
  2258. } else if (automarry == "已停止") {
  2259. var b = "<div class=\"item-commands\"><span id = 'onekeyjh'>参加喜宴</span></div>"
  2260. messageClear();
  2261. messageAppend("<hiy>点击参加喜宴</hiy>");
  2262. messageAppend(b);
  2263. $('#onekeyjh').on('click', function () {
  2264. Helper.xiyan();
  2265. });
  2266. }
  2267. }
  2268. }
  2269. if (data.ch == "rumor") {
  2270. if (data.content.indexOf("听说") >= 0 &&
  2271. data.content.indexOf("出现在") >= 0 &&
  2272. data.content.indexOf("一带。") >= 0) {
  2273. console.dir(data);
  2274. if (autoKsBoss == "已开启") {
  2275.  
  2276. Helper.kksBoss(data);
  2277. } else if (autoKsBoss == "已停止") {
  2278. var c = "<div class=\"item-commands\"><span id = 'onekeyKsboss'>传送到boss</span></div>";
  2279. messageClear();
  2280. messageAppend("boss已出现");
  2281. messageAppend(c);
  2282. $('#onekeyKsboss').on('click', function () {
  2283. Helper.kksBoss(data);
  2284. });
  2285. }
  2286. }
  2287. }
  2288. });
  2289. $.contextMenu({
  2290. selector: '.container',
  2291. items: {
  2292. "关闭自动": {
  2293. name: "关闭自动",
  2294. visible: function (key, opt) { return timer != 0;},
  2295. callback: function (key, opt) {WG.timer_close();},
  2296. },
  2297. "自动": {
  2298. name: "自动",
  2299. visible: function (key, opt) {return timer == 0;},
  2300. "items": {
  2301. "自动打坐学习": {
  2302. name: "自动打坐学习",
  2303. callback: function (key, opt) { WG.xue_auto();},
  2304. },
  2305. "自动武道": {
  2306. name: "自动武道",
  2307. callback: function (key, opt) {WG.wudao_auto();},
  2308. },
  2309. "自动小树林": {
  2310. name: "自动小树林",
  2311. callback: function (key, opt) {WG.grove_auto();}
  2312. },
  2313. "自动流氓巷": {
  2314. name: "自动流氓巷",
  2315. callback: function (key, opt) {WG.grove_auto2();}
  2316. },
  2317. "自动整理并清包": {
  2318. name: "自动整理并清包",
  2319. callback: function (key, opt) { WG.sell_all();}
  2320. },
  2321. "自动比试": {
  2322. name: "自动比试",
  2323. visible: function (key, opt) {return Helper.fight_listener == undefined;},
  2324. callback: function (key, opt) { Helper.auto_fight();},
  2325. },
  2326. "关闭比试": {
  2327. name: "关闭比试",
  2328. visible: function (key, opt) {return Helper.fight_listener != undefined;},
  2329. callback: function (key, opt) {Helper.auto_fight();},
  2330. },
  2331. "自动使用道具": {name: "自动使用道具",callback: function (key, opt) {Helper.auto_useitem();},},
  2332. },
  2333. },
  2334. "换装设置": {
  2335. name: "换装设置",
  2336. "items": {
  2337. "xx0": {name: "套装1设定或装备",callback: function (key, opt) {Helper.eqhelper(1);},},
  2338. "xx1": {name: "清除套装1设置",callback: function (key, opt) {Helper.eqhelperdel(1);},},
  2339. "yy0": {name: "套装2设定或装备",callback: function (key, opt) {Helper.eqhelper(2);},},
  2340. "yy1": {name: "清除套装2设置",callback: function (key, opt) {Helper.eqhelperdel(2);},},
  2341. "zz0": {name: "套装3设定或装备",callback: function (key, opt) {Helper.eqhelper(3);},},
  2342. "zz1": {name: "清除套装3设置",callback: function (key, opt) {Helper.eqhelperdel(3);},},
  2343. "uneq": {name: "取消所有装备",callback: function (key, opt) {Helper.uneqall();},},
  2344. }
  2345. },
  2346. "手动喜宴": {
  2347. name: "手动喜宴",callback: function (key, opt) {Helper.xiyan();},
  2348. },
  2349. "快捷传送": {
  2350. name: "常用地点",
  2351. "items": {
  2352. "mp0": {name: "豪宅",callback: function (key, opt) {WG.go("住房");},},
  2353. "mp1": {name: "当铺",callback: function (key, opt) {WG.go("扬州城-当铺");},},
  2354. "mp2": {name: "擂台",callback: function (key, opt) { WG.go("扬州城-擂台");},},
  2355. "mp3": {name: "帮派",callback: function (key, opt) {WG.go("扬州城-帮派");},},
  2356. "mp4": {name: "武道",callback: function (key, opt) {WG.go("武道塔");},},
  2357. "mp5": {name: "矿山",callback: function (key, opt) {WG.go("扬州城-矿山");},},
  2358. "mp6": {name: "药铺",callback: function (key, opt) {WG.go("扬州城-药铺");},},
  2359. "mp7": {name: "武庙疗伤",callback: function (key, opt) {WG.go("扬州城-武庙");WG.Send("liaoshang");},}
  2360. },
  2361. },
  2362. "门派传送": {
  2363. name: "门派传送",
  2364. "items": {
  2365. "mp0": {name: "武当",callback: function (key, opt) {WG.go("武当派-广场");},},
  2366. "mp1": {name: "少林",callback: function (key, opt) {WG.go("少林派-广场");},},
  2367. "mp2": {name: "华山",callback: function (key, opt) {WG.go("华山派-镇岳宫");},},
  2368. "mp3": {name: "峨眉",callback: function (key, opt) {WG.go("峨眉派-金顶")},},
  2369. "mp4": {name: "逍遥",callback: function (key, opt) {WG.go("逍遥派-青草坪");},},
  2370. "mp5": {name: "丐帮",callback: function (key, opt) {WG.go("丐帮-树洞内部");},},
  2371. "mp6": {name: "武馆",callback: function (key, opt) {WG.go("扬州城-扬州武馆");},}
  2372. },
  2373. },
  2374. "打开仓库": {name: "打开仓库",callback: function (key, opt) {WG.go("仓库");},},
  2375. "更新ID": {
  2376. name: "更新ID",
  2377. callback: function (key, opt) {
  2378. WG.updete_goods_id();
  2379. WG.updete_npc_id();
  2380. },
  2381. },
  2382. "调试BOSS": {
  2383. name: "调试BOSS",
  2384. visible: false,
  2385. callback: function (key, opt) {
  2386. Helper.kksBoss({
  2387. "content": "听说南陇侯出现在逍遥派-林间小道一带。"
  2388. });
  2389. },
  2390. },
  2391. "设置": {name: "设置",callback: function (key, opt) {WG.setting();},},
  2392. "计算器": {name: "计算器",callback: function (key, opt) {WG.calc();},},
  2393. "打开面板": {
  2394. name: "打开面板",
  2395. visible: function (key, opt) {return $('.WG_log').css('display') == 'none';},
  2396. callback: function (key, opt) {WG.showhideborad();},
  2397. },
  2398. "关闭面板": {
  2399. name: "关闭面板",
  2400. visible: function (key, opt) {return $('.WG_log').css('display') != 'none';},
  2401. callback: function (key, opt) {WG.showhideborad();},
  2402. }
  2403. }
  2404. });
  2405. });
  2406. })();