wsmud_funny

A script for Mud WuShen

  1. // ==UserScript==
  2. // @name wsmud_funny
  3. // @namespace suqing.fun
  4. // @version 0.3.38
  5. // @author SuQing, 白三三
  6. // @match http://*.wsmud.com/*
  7. // @match http://*.wamud.com/*
  8. // @exclude http://*.wsmud.com/news/*
  9. // @exclude http://*.wsmud.com/pay.html
  10. // @exclude http://*.wamud.com/news/*
  11. // @exclude http://*.wamud.com/pay.html
  12. // @homepage https://gf.qytechs.cn/zh-CN/scripts/380709
  13. // @description A script for Mud WuShen
  14. // @run-at document-start
  15. // @require https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
  16. // @grant unsafeWindow
  17. // @grant GM_addStyle
  18. // @grant GM_setValue
  19. // @grant GM_deleteValue
  20. // @grant GM_getValue
  21. // @grant GM_setClipboard
  22. // ==/UserScript==
  23.  
  24. function say(text) {
  25. let url = "https://fanyi.baidu.com/gettts?lan=zh&text=" + text + "&spd=5&source=web";
  26. let audio = new Audio(url);
  27. audio.play();
  28. }
  29. unsafeWindow.say = say;
  30.  
  31. (function() {
  32. "use strict";
  33. /********************变量********************/
  34. let isMoblie = false;
  35. let websocket = null;
  36. let fn_onmessage = null;
  37. let onmessage = event => {
  38. let message = Str2Obj(event.data);
  39. console.log(message);
  40. if (message.type === "dialog") message.type = message.dialog;
  41. for (let i = 0; i < listeners.length; i++) {
  42. let fn = listeners[i];
  43. if (fn === null) continue;
  44. if (fn(event, message) === false) return;
  45. }
  46. fn_onmessage.apply(this, [event]);
  47. }
  48. let listeners = [];//监听
  49. let addListener = fn => {
  50. let id = listeners.length;
  51. listeners.push(fn);
  52. return id;
  53. };
  54. let removeListener = id => listeners[id] = null;
  55.  
  56. let title = new Proxy({ name: "RoleName", state: "<STATE>" }, {
  57. set: function (title, key, value) {
  58. title[key] = value;
  59. $("head title").html(title.name + title.state);
  60. return true;
  61. },
  62. get: function (title, key) {
  63. return title[key];
  64. }
  65. });
  66. let roles = {};
  67. let id = "";
  68. let login = false;
  69. let showTimeStr = false;
  70. let role = new Proxy({}, {
  71. set: function (role, key, value) {
  72. if (!isMoblie) {
  73. if (key === "name" && role.name) return true;//name不变
  74. $(".role_" + key).html(value);
  75. }
  76. role[key] = value;
  77. return true;
  78. },
  79. get: function (role, key) {
  80. return role[key];
  81. }
  82. });
  83. let skills = new Proxy({}, {
  84. set: function (skills, key, value) {
  85. skills[key] = value;
  86. return true;
  87. },
  88. get: function (skills, key) {
  89. return skills[key];
  90. }
  91. });
  92. let room = new Proxy({ str: "a-b", name1: "a", name2: "b", path: "a/b/c", items: [] }, {
  93. set: function (room, key, value) {
  94. room[key] = value;
  95. return true;
  96. },
  97. get: function (room, key) {
  98. return room[key];
  99. }
  100. });
  101. let exits = {};
  102.  
  103. let content = new Proxy({ qn: 0, jy: 0, nl: 0, task: "任务", lwsb: "领悟石壁" }, {
  104. set: function (content, key, value) {
  105. if ($(".remove_" + key)[0]) {
  106. $(".remove_" + key).remove();
  107. }
  108. content[key] = value;
  109. return true;
  110. },
  111. get: function (content, key) {
  112. return content[key];
  113. }
  114. });
  115.  
  116. {//检查判断
  117. if (!/test/.test(GM_info.script.version)) {//根据是否测试决定是否屏蔽console.log
  118. console.log = target => {
  119. return;
  120. };
  121. }
  122. if (navigator.userAgent) {//判断设备是否为移动端
  123. let agent = navigator.userAgent.toLowerCase();
  124. if (/ipad|iphone|android|mobile/.test(agent)) {
  125. isMoblie = true;
  126. }
  127. console.log(agent);
  128. }
  129. if (WebSocket) {//检测WebSocket
  130. unsafeWindow.WebSocket = function (uri) {
  131. websocket = new WebSocket(uri);
  132. };
  133. unsafeWindow.WebSocket.prototype = {
  134. get url() {
  135. return websocket.url;
  136. },
  137. get protocol() {
  138. return websocket.protocol;
  139. },
  140. get readyState() {
  141. return websocket.readyState;
  142. },
  143. get bufferedAmount() {
  144. return websocket.bufferedAmount;
  145. },
  146. get extensions() {
  147. return websocket.extensions;
  148. },
  149. set binaryType(type) {
  150. websocket.binaryType = type;
  151. },
  152. get binaryType() {
  153. return websocket.binaryType;
  154. },
  155. set onerror(fn) {
  156. websocket.onerror = fn;
  157. },
  158. get onerror() {
  159. return websocket.onerror;
  160. },
  161. set onopen(fn) {
  162. websocket.onopen = fn;
  163. title.state = "<已连接>";
  164. },
  165. get onopen() {
  166. return websocket.onopen;
  167. },
  168. set onclose(fn) {
  169. websocket.onclose = fn;
  170. title.state = "<已离线>";
  171. //setTimeout(() => websocket.onopen(), 5000);//自动重连
  172. },
  173. get onclose() {
  174. return websocket.onclose;
  175. },
  176. set onmessage(fn) {
  177. fn_onmessage = fn;
  178. websocket.onmessage = onmessage;
  179. },
  180. get onmessage() {
  181. return websocket.onmessage;
  182. },
  183. send: command => SendCommand(command),
  184. close: () => websocket.close(),
  185. };
  186. } else return;//WebSocket不存在直接结束
  187. }//检查判断
  188.  
  189. /********************监控********************/
  190. addListener(function (event, message) {
  191. if (message.type === "roles") {
  192. message.roles.forEach(role => {
  193. let id = role.id;
  194. let name = role.name;
  195. roles[id] = name;
  196. });
  197. } else if (message.type === "login") {
  198. id = message.id;
  199. title.name = roles[id];
  200. title.state = "<已登录(不可用)>";
  201. role.name = roles[id];
  202. }
  203. return true;
  204. });//roles/login
  205. addListener(function (event, message) {
  206. if (message.type === "room" && !unsafeWindow.WG) {
  207. room.str = message.name.replace("(副本区域)", "");
  208. let x = room.str.match(/(.*)-(.*)/);
  209. room.name1 = x[1];
  210. room.name2 = x[2];
  211. room.path = message.path;
  212. room.desc = message.desc;
  213. if (room.desc.length > 20) {
  214. let desc0 = room.desc.replace(/<([^<]+)>/g, "");
  215. let desc1 = desc0.substr(0, 20);
  216. let desc2 = desc0.substr(20);
  217. message.desc = `${desc1}<span id="show"> <hic>»»»</hic></span><span id="more" style="display:none">${desc2}</span><span id="hide" style="display:none"> <hic>«««</hic></span>`;
  218. }
  219. if (room.desc.includes("cmd")) {
  220. // 四周灰蒙蒙的不知身在何处,在你的正前方一根巨大的柱子虚空而立,柱子上雕刻着一些神秘的花纹,底下立着一块残破的<cmd cmd="look bei">石碑</cmd>,上面写着【戊申】两个大字。
  221. // <cmd cmd="look bei">石碑</cmd>
  222. //console.log(room.desc);
  223. room.desc = room.desc.replace("<hig>椅子</hig>", "椅子");//新手教程的椅子
  224. room.desc = room.desc.replace("<CMD cmd='look men'>门(men)<CMD>", "<cmd cmd='look men'>门</cmd>");//兵营副本的门
  225. room.desc = room.desc.replace(/span/g, "cmd"); //古墓里的画和古琴是<span>标签
  226. room.desc = room.desc.replace(/"/g, "'"); // "" => ''
  227. room.desc = room.desc.replace(/\((.*?)\)/g, "");//去除括号和里面的英文单词
  228. //console.log(room.desc);
  229. let cmds = room.desc.match(/<cmd cmd='([^']+)'>([^<]+)<\/cmd>/g);
  230. //console.log(cmds);
  231. cmds.forEach(cmd => {
  232. let x = cmd.match(/<cmd cmd='(.*)'>(.*)<\/cmd>/);
  233. message.commands.unshift({ cmd: x[1], name: `<hic>${x[2]}</hic>` });
  234. });
  235. // room.desc = room.desc.replace(/<([^<]+)>/g, "");
  236. cmds.forEach(desc => message.desc = `<hic>${desc}</hic> ${message.desc}`);
  237. }
  238.  
  239. let event0 = DeepCopy(event);
  240. //message.desc = room.desc.substr(0, 20) + "……";
  241. event0.data = JSON.stringify(message);
  242. fn_onmessage.apply(this, [event0]);
  243. $("#show").click(() => {
  244. $("#more").show();
  245. $("#show").hide();
  246. $("#hide").show();
  247. });
  248. $("#hide").click(() => {
  249. $("#more").hide();
  250. $("#show").show();
  251. $("#hide").hide();
  252. });
  253. return false;
  254. } else if (message.type === "exits") {
  255. for (const key in exits) delete exits[key];//先清空
  256. for (const key in message.items) {
  257. exits[key] = message.items[key];
  258. exits[message.items[key]] = "go " + key;
  259. }
  260. }
  261. return true;
  262. });//room/exits
  263. addListener(function (event, message) {
  264. if (message.type === "items") {
  265. room.items = [];
  266. message.items.forEach(item => {
  267. if (item === 0) {
  268. } else if (item.id && item.name && Object.entries(item).length === 2) {//只有id和name的是物品或者尸体
  269. if (!item.name.includes("尸体")) {
  270. SendCommand(`get ${item.id}`);//自动拾取不是尸体的物品
  271. }
  272. } else if (item.p !== 1) {//不是玩家的NPC保存起来
  273. room.items.push(item);
  274. }
  275. });
  276. }
  277. if (message.type === "itemadd" && message.p !== 1) {
  278. room.items.push(message);
  279. }
  280. if (message.type === "itemremove") {
  281. let index = room.items.findIndex(item => {
  282. return item.id === message.id;
  283. });
  284. if (index !== -1) room.items.splice(index, 1);//删除
  285. }
  286. return true;
  287. });//items/itemadd/itemremove
  288. addListener(function (event, message) {
  289. if (message.type === "state") {
  290. if (message.state) {
  291. title.state = `<${message.state.replace("你正在", "")}>`;
  292. } else title.state = `<闲逛中>`;
  293.  
  294. if (message.desc instanceof Array && message.desc.length > 0) {//状态文本如果有的话就删去
  295. message.desc = [];
  296. let event0 = DeepCopy(event);
  297. event0.data = JSON.stringify(message);
  298. fn_onmessage.apply(this, [event0]);
  299. return false;
  300. }
  301. } else if (message.type === "combat") {
  302. if (message.start === 1) {
  303. title.state = "<战斗中>";
  304. } else if (message.end === 1) {
  305. title.state = "<闲逛中>";
  306. }
  307. }
  308. return true;
  309. });//state/combat
  310. addListener(function (event, message) {
  311. if (message.type === "text") {
  312. if (/重新连线|欢迎登陆/.test(message.text)) {
  313. message.text += `\n${GM_info.script.name} ${GM_info.script.version}\n`;
  314. if (GM_info.script.version.includes("test")) {
  315. message.text += `\n<hiw>当前测试版,如有问题可回退版本。\n</hiw>`;
  316. }
  317. if (login === false) {
  318. login = true;
  319. SendCommand(["greet master", "pack", "score2", "score"]);//自动请安师傅
  320. setTimeout(() => $("[command=skills]").click(), 200);
  321. setTimeout(() => $("[command=tasks]").click(), 400);
  322. if (!unsafeWindow.WG) {
  323. setTimeout(() => $("[command=showtool]").click(), 600);
  324. setTimeout(() => $("[command=showcombat]").click(), 800);
  325. }
  326. setTimeout(() => $(".dialog-close").click(), 1000);
  327. }
  328. AddContent(message.text);
  329. return false;
  330. } else if (/你获得了(.*)点经验,(.*)点潜能/.test(message.text)) {
  331. let x = message.text.match(/获得了(.*)点经验,(.*)点潜能/);
  332. content.jy += parseInt(x[1]);
  333. content.qn += parseInt(x[2]);
  334. message.text += `<span class="remove_jy">\n共计获得了${content.jy}点经验和${content.qn}点潜能。</span>\n`;
  335. return AddContent(message.text);
  336. } else if (/看起来(.*)想杀死你/.test(message.text)) {
  337. let x = message.text.match(/看起来(.*)想杀死你/);
  338. message.text = `<hir>${x[1]}开始攻击你!<hir>\n`;
  339. return AddContent(message.text);
  340. } else if (/你对著(.*)喝道/.test(message.text)) {
  341. let x = message.text.match(/你对著(.*)喝道/);
  342. message.text = `<hir>你开始攻击${x[1]}!<hir>\n`;
  343. return AddContent(message.text);
  344. } else if (/你扑向(.*)/.test(message.text)) {
  345. let x = message.text.match(/你扑向(.*)!/);
  346. message.text = `<hir>你开始攻击${x[1]}!<hir>\n`;
  347. return AddContent(message.text);
  348. } else if (/只留下一堆玄色石头/.test(message.text) && message.text.includes("你")) {
  349. let x = message.text.match(/只见(.*)发出一阵白光/);
  350. message.text = `你分解了${x[1]}!\n`;
  351. return AddContent(message.text);
  352. } else if (/爆出一阵炽热的光芒,周身似乎有雷光环绕,连绵不绝!/.test(message.text)) {
  353. let x = message.text.match(/(.*)的(.*)爆出一阵炽热的光芒/);
  354. message.text = `${x[1]}精炼了${x[2]}!\n`;
  355. return AddContent(message.text);
  356. } else if (/发出一阵耀眼的光芒,看上去似乎变强了!/.test(message.text)) {
  357. let x = message.text.match(/(.*)的(.*)发出一阵耀眼的光芒/);
  358. message.text = `${x[1]}精炼了${x[2]}!\n`;
  359. return AddContent(message.text);
  360. } else if (/发出一阵璀璨的光芒,看上去似乎更加强大了!/.test(message.text)) {
  361. let x = message.text.match(/(.*)的(.*)发出一阵璀璨的光芒/);
  362. message.text = `${x[1]}精炼了${x[2]}!\n`;
  363. return AddContent(message.text);
  364. } else if (/你从武道秘籍中领悟到了/.test(message.text)) {
  365. Beep();//武道书读完的提示音
  366. } else if (/你身上没有挖矿工具。/.test(message.text)) {
  367. // SendCommand([]);//小号没有铁镐的情况
  368. }
  369. }
  370. return true;
  371. });//text
  372.  
  373. addListener(function (event, message) {
  374. if (message.type === "text") {
  375. if (/你轻声吟道/.test(message.text)
  376. || /你用内力把玄晶炼化,小心翼翼的试图引入/.test(message.text)
  377. || /你的(.*)等级提升了!/.test(message.text)
  378. ) return false;
  379.  
  380. if (/你身上东西太多了|你拿不下那么多东西。/.test(message.text)) {
  381. AddContent(`<hir>友情提示:请检查是否背包已满!</hir>`);
  382. Beep();
  383. }
  384. }
  385. return true;
  386. });//text
  387.  
  388. addListener(function (event, message) {
  389. if (message.type === "skills") {
  390. if (message.items) {//所有技能数据
  391. role.skill_limit = message.limit;
  392. role.pot = message.pot;
  393. role.skill_count = message.items.length;
  394. role.skills = message.items;
  395. message.items.forEach(skill => {
  396. let color = ["/", "wht", "hig", "hic", "hiy", "hiz", "hio", "ord"];
  397. for (let i = 1; i < color.length; i++) {
  398. if (skill.name.includes(color[i])) {
  399. skill.color = i;
  400. break;
  401. }
  402. }
  403. skills[skill.id] = skill;
  404. });
  405. } else if (message.item) {//学会新技能
  406. let color = ["/", "wht", "hig", "hic", "hiy", "hiz", "hio", "ord"];
  407. for (let i = 1; i < color.length; i++) {
  408. if (message.item.name.includes(color[i])) {
  409. message.item.color = i;//新学的技能也要添加上颜色
  410. break;
  411. }
  412. }
  413. skills[message.item.id] = message.item;
  414. } else if (message.enable) {//装备上一个技能
  415. skills[message.id].enable_skill = message.enable;
  416. } else if (message.exp) {//单个技能经验变动
  417. let skill = skills[message.id];
  418. if (!skill) return true;//防错
  419. if (message.level) {
  420. skill.level = message.level;
  421. AddContent(`<hig>你的技能${skill.name}提升到<hiw>${skill.level}</hiw>级!</hig>\n`);
  422. }
  423.  
  424. let limit = role.skill_limit;
  425. let study_per = parseInt(role.study_per);
  426. let lianxi_per = parseInt(role.lianxi_per);
  427. let int = parseInt(role.int);//悟性
  428. let int_add = parseInt(role.int_add);
  429. let level = parseInt(skill.level);
  430. let k = skill.color * 2.5;//系数白2.5/../橙15/红17.5
  431. let qn = (limit * limit - level * level) * k;
  432.  
  433. if (title.state.includes("练习技能")) {
  434. let time = qn / (int + int_add) / (1 + lianxi_per / 100 - int / 100) / (60 / 5);
  435. let timeStr = time < 60 ? `${parseInt(time)}分钟` : `${parseInt(time / 60)}小时${parseInt(time % 60)}分钟`;
  436. //练习每一跳的消耗公式=(先天悟性+后天悟性)×(1+练习效率%-先天悟性%)
  437. let cost = parseInt(qn / time / 12);
  438. role.lianxi_cost = cost;
  439. AddContent(`练习${skill.name}消耗了${cost}点潜能。\n`);
  440.  
  441. $(".remove_lianxi").remove();
  442. AddContent(
  443. $(`<span class="remove_lianxi"></span>`).append(
  444. $(`<hig>悟性: ${int}+${int_add} 效率: ${lianxi_per}% </hig>`),
  445. $(`<span class="span-btn"></span>`).append("刷新").click(() => SendCommand(["score2", "score"])),
  446. $(`<span>\n<span>`)
  447. )
  448. );
  449. let LEVEL = [300, 500, 800, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, limit];
  450. for (let i = 0; i < LEVEL.length; i++) {
  451. let l = LEVEL[i];
  452. if (skill.level < l && l <= limit) {
  453. let qn = (l * l - level * level) * k;
  454. let time = qn / (int + int_add) / (1 + lianxi_per / 100 - int / 100) / (60 / 5);
  455. let timeStr = time < 60 ? `${parseInt(time)}分钟` : `${parseInt(time / 60)}小时${parseInt(time % 60)}分钟`;
  456. AddContent(`<span class="remove_lianxi">练习到${l}级需要${timeStr},消耗${qn}潜能。\n</span>`);
  457. if (l === limit) break;
  458. }
  459. }
  460. // AddContent(`<hic class="remove_lianxi">练习到${limit}级需要${timeStr}并消耗${qn}潜能。\n</hic>`);
  461. // $(".remove_lxsj").remove();
  462. // AddContent(`<span class="remove_lxsj">角色\n练习效率: ${lianxi_per}%\n等级上限: ${limit}级\n需要潜能: ${qn}\n需要时间: ${timeStr}\n</span>`);
  463. } else if (title.state.includes("学习")) {
  464. //学习每一跳的消耗公式=(先天悟性+后天悟性)×(1+学习效率%-先天悟性%)×3
  465. let cost = parseInt((int + int_add) * (1 + study_per / 100 - int / 100) * 3);
  466. role.study_cost = cost;
  467. AddContent(`学习${skill.name}消耗了${cost}点潜能。\n`);
  468. }
  469. }
  470. }
  471. return true;
  472. });//skills
  473.  
  474. addListener(function (event, message) {
  475. if (message.type === "items") {
  476. room.items.forEach(item => {
  477. if (item.name.includes("程药发")) {
  478. SendCommand([250, `select ${item.id}`]);
  479. } else if (item.name.includes("唐楠")) {
  480. SendCommand([250, `list ${item.id}`, "sell all"]);
  481. }
  482. });
  483. }
  484. return true;
  485. });//npc
  486.  
  487. /*****内力计算*****/
  488. addListener(function (event, message) {
  489. if (message.type === "text" && /你的最大内力增加了/.test(message.text)) {
  490. let x = message.text.match(/你的最大内力增加了(.*)点。/);
  491. content.nl = parseInt(x[1]);
  492. let max = role.max_mp;
  493. let limit = role.limit_mp;
  494. let t = (limit - max) / (content.nl * 6);//时间/分钟
  495. let tStr = t < 60 ? `${parseInt(t)}分钟` : `${parseInt(t / 60)}小时${parseInt(t % 60)}分钟`;
  496. message.text += `\n<hic class="remove_nl">你的最大内力从${max}到${limit}还需${tStr}。\n</hic>`;
  497. return AddContent(message.text);
  498. } else if (message.type === "sc" && message.id === id) {
  499. role.hp = message.hp;
  500. role.mp = message.mp;
  501. role.max_hp = message.max_hp;
  502. role.max_mp = message.max_mp;
  503. }
  504. return true;
  505. });
  506. /*****侠客岛领悟石壁辅助*****/
  507. addListener(function (event, message) {
  508. if (message.type === "text" && /石破天对你说到:你知道(.*)是什么意思吗?/.test(message.text)) {
  509. let xkx = [//侠客行诗句 救赵挥金槌
  510. ["赵客缦胡缨", "吴钩霜雪明", "银鞍照白马", "飒沓如流星"],
  511. ["十步杀一人", "千里不留行", "事了拂衣去", "深藏身与名"],
  512. ["闲过信陵饮", "脱剑膝前横", "将炙啖朱亥", "持觞劝侯嬴"],
  513. ["三杯吐然诺", "五岳倒为轻", "眼花耳热后", "意气素霓生"],
  514. ["救赵挥金槌", "邯郸先震惊", "千秋二壮士", "煊赫大梁城"],
  515. ["纵死侠骨香", "不惭世上英", "谁能书阁下", "白首太玄经"],
  516. ];
  517. let go = ["go east", "go south", "go west", "go north"];
  518. let x = message.text.match(/石破天对你说到:你知道(.*)是什么意思吗?/);
  519. for (let i = 0; i < xkx.length; i++) {
  520. for (let j = 0; j < xkx[i].length; j++) {
  521. if (xkx[i][j] === x[1]) {
  522. AddContent(`<hig>检测到诗句<hiw>${x[1]}</hiw>,苏轻将帮你寻找石室。\n</hig>`);
  523. SendCommand(["stopstate", "go enter", go[j], "lingwu bi"]);
  524. break;
  525. }
  526. }
  527. }
  528. }
  529. if (message.type === "skills" && title.state === "<领悟石壁>") {
  530. let skill = skills[message.id];
  531. if (!skill) return;
  532. let x = skill.name.match(/<wht>基本(.*)<\/wht>/);
  533. content.lwsb = "是" + x[1];
  534. if (message.level) {
  535. AddContent(`<hig>领悟石壁完成,苏轻将帮你寻找石破天。\n</hig>`);
  536. let go = exits["山洞"];
  537. let say = `say ${content.lwsb}`;
  538. SendCommand(["stopstate", go, "go out", say, "cr"]);
  539. setTimeout(() => Beep(), 1000);//提示音
  540. }
  541. AddContent(`由于领悟石壁,你的技能${skill.name}提升到了<hig>${message.exp}%</hig>!\n`);
  542. if (message.exp < 90) {
  543. $(".remove_exp_90").remove();
  544. AddContent(`<hir class="remove_exp_90">建议将技能熟练度练习到90%以上再继续领悟石壁!\n</hir>`);
  545. }
  546. }
  547.  
  548. return true;
  549. });
  550.  
  551. addListener(function (event, message) {//type=msg
  552. if (message.type === "msg" && !isMoblie) {//判断是否移动端
  553. let uid = message.uid;
  554. let txt = message.content;
  555. let name = message.name ? message.name + ":" : "";
  556.  
  557. let time = `<hik class="timeStr" ${showTimeStr ? "" : 'style="display:none"'}> ${Time2Str()}</hik>`;
  558. let look3 = function () {
  559. SendCommand(`look3 ${$(this).attr("uid")}`);
  560. };
  561. if (message.ch === "chat") {
  562. let levels = ["<hic>闲聊</hic>", "<hic>闲聊</hic>", "<hic>闲聊</hic>", "<hiy>宗师</hiy>", "<hiz>武圣</hiz>", "<hio>武帝</hio>", "<hir>武神</hir>"];
  563. $(".chat").append($(`<hic uid="${uid}">【${levels[message.lv]}】${name}${txt}${time}<br></hic>`).click(look3));
  564. } else if (message.ch === "fam") {
  565. $(".fam").append($(`<hiy uid="${uid}">【${message.fam}】${name}${txt}${time}<br></hiy>`).click(look3));
  566. } else if (message.ch === "pty") {
  567. $(".pty").append($(`<hiz uid="${uid}">【帮派】${name}${txt}${time}<br></hiz>`).click(look3));
  568. } else if (message.ch === "tm") {
  569. $(".tm").append(`<hig>【队伍】${name}${txt}${time}<br></hig>`);
  570. } else if (message.ch === "es") {
  571. $(".es").append(`<hio>【${message.server}】${name}${txt}${time}<br></hio>`);
  572. } else if (message.ch === "rumor") {//谣言
  573. // if (/闭关修炼/.test(txt)) {
  574. // let x = txt.match(/武帝(.*)闭关修炼似有所悟,你随之受益获得了(.*)经验,(.*)潜能/);
  575. // $(".rumor").append(`<him>【谣言】武帝<hio>${x[1]}</hio>出关奖励<hio>${x[2]}</hio>点。</him><br>`);
  576. // } else if (/战胜了/.test(txt)) {
  577. // let x = txt.match(/听说(.*)战胜了(.*)获得了(.*)称号!/);
  578. // $(".rumor").append("<him>【谣言】" + x[1] + "获得了" + x[3] + "称号!</him><br>");
  579. // } else if (/郭大侠收到线报/.test(txt)) {
  580. // $(".rumor").append("<him>【谣言】蒙古大军将会进攻襄阳!" + time + "</him><br>");
  581. // } else if (/出现在/.test(txt)) {
  582. // let x = txt.match(/听说(.*)出现在(.*)-(.*)一带。/);
  583. // $(".rumor").append(`<him>【谣言】<hio>${x[1]}</hio>出现在${x[2]}${x[3]}!${time}</him><br>`);
  584. // } else {
  585. // $(".rumor").append(`<him>【谣言】${txt}</him><br>`);
  586. // }
  587. $(".rumor").append(`<him>【谣言】${txt}</him><br>`);
  588. } else if (message.ch === "sys") {//系统
  589. // if (/欢迎登录(不可用)|非法收益/.test(txt)) return true;
  590. // else if (/挖矿技巧/.test(txt)) txt = txt.match(/(.*)捡到一本挖矿指南/)[1] + "使用了挖矿指南!";
  591. // else if (/,望各路英雄鼎力相助/.test(txt)) txt = txt.replace(",望各路英雄鼎力相助", "");
  592. // else if (/蒙古大军挥军南下/.test(txt)) txt = txt.replace("蒙古大军挥军南下,", "");
  593. // else if (/蒙古大汗蒙哥出现在战场中央/.test(txt)) txt = "蒙古大汗蒙哥出现在战场中央!";
  594. // else if (/蒙古可汗蒙哥被击杀于襄阳城下/.test(txt)) txt = txt.replace("蒙古可汗蒙哥被击杀于襄阳城下,", "");
  595. $(".sys").append(`<hir>【系统】${txt}${time}</hir><br>`);
  596. AutoScroll(".sys");
  597. }
  598. AutoScroll("." + message.ch);
  599. $(".channel pre").html("");
  600. }
  601. return true;
  602. });
  603. addListener(function (event, message) {//type=tasks
  604. if (message.type === "tasks" && message.items && !unsafeWindow.WG) {
  605. let fb, qa, wd, wd1, wd2, wd3, xy, mpb, boss, wdtz, sm1, sm2, ym1, ym2, yb1, yb2;
  606. message.items.forEach(task => {
  607. if (task.state === 2) SendCommand(`taskover ${task.id}`);//自动完成
  608. if (task.id === "signin") {
  609. // let a = task.desc.match(/师门任务:(.*),副本:<(.*)>(.*)\/20<(.*)>/);
  610. // let b = task.desc.match(/(.*)武道塔(.*),进度(.*)\/(.*)<(.*)>,<(.*)>(.*)首席请安<(.*)>/);
  611. // (parseInt(a[3]) < 20) ? fb = `<hig>${a[3]}</hig>` : fb = a[3];
  612. // (parseInt(b[3]) < parseInt(b[4])) ? wd1 = `<hig>${b[3]}</hig>` : wd1 = b[3];
  613. // wd2 = b[4];
  614. // /可以重置/.test(b[2]) ? wd3 = "<hig>可以重置</hig>" : wd3 = "已经重置";
  615. // /已经/.test(b[7]) ? qa = "已经请安" : qa = "<hig>尚未请安</hig>";
  616. const a = task.desc.match(/精力消耗:<...>(\d+)\/200<....>/);
  617. if (a) {
  618. fb = parseInt(a[1]) < 200 ? `<hig>${a[1]}</hig>` : a[1];
  619. }
  620.  
  621. const b = task.desc.match(/武道塔(.+),进度(\d+)\/(\d+)<....>/);
  622. if (b) {
  623. wd1 = b[2];
  624. wd2 = b[3];
  625. if (wd1 < wd2) wd1 = `<hig>${wd1}</hig>`;
  626. /可以重置/.test(b[1]) ? wd3 = "<hig>可以重置</hig>" : wd3 = "已经重置";
  627. wd = wd1+"/"+wd2+" "+wd3
  628. } else {wd = "只打塔主"}
  629.  
  630. const c = task.desc.match(/<.+?>(.+)首席请安<.+?>/);
  631. if (c) {
  632. /已经/.test(c[1]) ? qa = "已经请安" : qa = "<hig>尚未请安</hig>";
  633. } else {qa = "无需请安"}
  634.  
  635. const d = task.desc.match(/尚未协助襄阳守城/);
  636. (d) ? xy = `<hig>0</hig>` : xy = 1;
  637.  
  638. const e = task.desc.match(/尚未挑战门派BOSS/);
  639. (e) ? mpb = `<hig>0</hig>` : mpb = 1;
  640.  
  641. const f = task.desc.match(/挑战武神BOSS(\d+)次/);
  642. if (f) {
  643. boss = 5 - parseInt(f[1]);
  644. boss = `<hig>${boss}</hig>`;
  645. }else{
  646. if (G.level && G.level.indexOf('武神') >= 0) boss = 5;
  647. }
  648. const g = task.desc.match(/尚未挑战武道塔塔主/);
  649. (g) ? wdtz = `<hig>0</hig>/1` : wdtz = `已打或未解锁`;
  650. } else if (task.id === "sm") {
  651. let a = task.desc.match(/目前完成(.*)\/20个,共连续完成(.*)个。/);
  652. (parseInt(a[1]) < 20) ? sm1 = `<hig>${a[1]}</hig>` : sm1 = a[1];
  653. sm2 = a[2];
  654. } else if (task.id === "yamen") {
  655. let a = task.desc.match(/目前完成(.*)\/20个,共连续完成(.*)个。/);
  656. (parseInt(a[1]) < 20) ? ym1 = `<hig>${a[1]}</hig>` : ym1 = a[1];
  657. ym2 = a[2];
  658. } else if (task.id === "yunbiao") {
  659. let a = task.desc.match(/本周完成(.*)\/20个,共连续完成(.*)个。/);
  660. (parseInt(a[1]) < 20) ? yb1 = `<hig>${a[1]}</hig>` : yb1 = a[1];
  661. yb2 = a[2];
  662. }
  663. });
  664. let html = `门派请安 => ${qa}\n武道之塔 => ${wd}\n`;
  665. html += `精力消耗 => ${fb}/200\n师门任务 => ${sm1}/20 ${sm2}连\n`;
  666. html += `衙门追捕 => ${ym1}/20 ${ym2}连\n每周运镖 => ${yb1}/20 ${yb2}连\n`;
  667. html += `襄阳守城 => ${xy}/1 门派BOSS => ${mpb}/1\n`;
  668. html += `武道塔主 => ${wdtz}\n`;
  669. if (boss) html += `武神BOSS => ${boss}/5\n`;
  670. content.task = `<span class="remove_task">${html}<span>`;
  671. AddContent(content.task);
  672. }
  673. return true;
  674. });
  675.  
  676. addListener(function (event, message) {//type=score
  677. if (message.type === "score") {
  678. for (const key in message) role[key] = message[key];
  679. }
  680. return true;
  681. });
  682.  
  683. let pack = new Proxy({ items: [], eqs: [], max: 0, moneyStr: "", }, {
  684. set: function (pack, key, value) {
  685. if (key === "moneyStr") $(".role_money").html(value);
  686. pack[key] = value;
  687. return true;
  688. },
  689. get: function (pack, key) {
  690. return pack[key];
  691. }
  692. });
  693.  
  694. let ITEMS = [
  695. "师门补给包", "背包扩充石", "小箱子", "随从礼包",
  696. "神魂碎片", "武道</hio>", "武道残页", "元晶", "帝魄碎片", "ord", "hir",
  697. "玄晶", "养精丹</hig>", "养精丹", "培元丹", "玫瑰花",
  698. "扫荡符", "天师符", "叛师符", "洗髓丹", "<hig>喜宴", "<hic>喜宴", "<hiy>喜宴",
  699. "师门令牌</hig>", "师门令牌</hic>", "师门令牌</hiy>", "师门令牌</HIZ>", "师门令牌</hio>",//师门令牌排序
  700. "碎裂的红宝石", "碎裂的绿宝石", "碎裂的蓝宝石", "碎裂的黄宝石",//宝石排序
  701. "红宝石</hic>", "绿宝石</hic>", "蓝宝石</hic>", "黄宝石</hic>",
  702. "精致的红宝石", "精致的绿宝石", "精致的蓝宝石", "精致的黄宝石",
  703. "完美的红宝石", "完美的绿宝石", "完美的蓝宝石", "完美的黄宝石",
  704. "聚气丹</hig>", "聚气丹</hic>", "聚气丹</hiy>", "聚气丹</HIZ>", "聚气丹</hio>",//聚气丹排序
  705. "突破丹</hig>", "突破丹</hic>", "突破丹</hiy>", "突破丹</hiz>", "突破丹</hio>",//突破丹排序
  706. "残页</hio>", "残页</HIZ>", "残页</hiy>", "残页</hic>", "残页</hig>",//残页排序
  707. "鲤鱼", "草鱼", "鲢鱼", "鲮鱼", "鳊鱼", "鲂鱼", "黄金鳉", "黄颡鱼", "太湖银鱼", "虹鳟", "孔雀鱼", "反天刀",//鱼排序
  708. "银龙鱼", "黑龙鱼", "罗汉鱼", "巨骨舌鱼", "七星刀鱼", "帝王老虎魟",
  709. "当归", "芦荟", "山楂叶", "柴胡", "金银花", "石楠叶", "茯苓", "沉香", "熟地黄", "九香虫", "络石藤", "冬虫夏草",//药材排序
  710. "人参", "何首乌", "凌霄花", "灵芝", "天仙藤", "盘龙参",
  711. "秘籍</wht>", "秘籍",
  712. "四十二章经一", "四十二章经二", "四十二章经三", "四十二章经四", "四十二章经五", "四十二章经六", "四十二章经七", "四十二章经八",
  713. ];
  714.  
  715. addListener(function (event, message) {
  716. function autoUse(item) {
  717. if (/养精丹|朱果|潜灵果|背包扩充石|随从礼包/.test(item.name)) {
  718. let cmd = ["stopstate"];
  719. let count = item.count;
  720. let zl = "use";
  721. if (/<hig>养精丹<\/hig>/.test(item.name)) count = count > 10 ? 10 : count;
  722. if (/小箱子|师门补给包|随从礼包/.test(item.name)) zl = "open";
  723. for (let i = 0; i < count; i++) {
  724. cmd.push(zl + " " + item.id);
  725. cmd.push(250);
  726. }
  727. AddContent(
  728. $(`<span class="span-btn">使用 ${item.name} ${count}次</span>`).click(() => SendCommand(cmd)),
  729. );
  730. AddContent(`\n`);
  731. }
  732. }
  733. if (message.type === "pack") {
  734. if (message.money) pack.moneyStr = Money2Str(message.money);
  735. if (message.max_item_count) pack.max = message.max_item_count;
  736. if (message.eqs) pack.eqs = message.eqs;
  737. if (message.remove) {//失去物品
  738. let id = message.id;
  739. let item = pack.items.find(item => {
  740. return item.id === id;
  741. });
  742. if (item) item.count -= message.remove;
  743. }
  744. if (!isMoblie && message.name && !message.name.includes("<wht>")) {//获得物品
  745. let id = message.id;
  746. let add = 0;
  747. let count = message.count;
  748. let item = pack.items.find(item => {
  749. return item.id === id;
  750. });
  751. if (item) {
  752. if (pack[id]) {
  753. add = count - item.count + pack[id];
  754. item.count = count;
  755. pack[id] = add;
  756. } else add = count - item.count;
  757. } else {
  758. add = count;
  759. pack[id] = add;
  760. pack.items.push(message);
  761. }
  762. let str = `共有${count}${message.unit}`;
  763. if (message.can_eq === 1) str = "";
  764. $(`.remove_${message.id}`).remove();
  765. $(".content-pickup").append(
  766. $(`<div class="remove_${message.id} pickup-row"></div>`).append(
  767. $(`<span class="pickup-add"></span>`).append(`获得${add}${message.unit}${message.name}`),
  768. $(`<span class="pickup-count"></span>`).append(str),
  769. )
  770. );
  771. AutoScroll(".content-pickup");
  772. if (!unsafeWindow.WG) autoUse(message);
  773. }
  774. if (message.items) {
  775. pack.items = [];
  776. ITEMS.forEach(name => {
  777. for (let i = 0; i < message.items.length; i++) {
  778. let item = message.items[i];
  779. if (item !== 0 && item.name.includes(name)) {
  780. pack.items.push(message.items[i]);
  781. message.items[i] = 0;
  782. }
  783. }
  784. });
  785. message.items.forEach(item => {
  786. if (item !== 0) pack.items.push(item);
  787. });
  788. if (!unsafeWindow.WG) pack.items.forEach(item => autoUse(item));
  789. message.items = pack.items;
  790. message.type = "dialog";
  791. let event0 = DeepCopy(event);
  792. event0.data = JSON.stringify(message);
  793. fn_onmessage.apply(this, [event0]);
  794. return false;
  795. }
  796. }
  797. return true;
  798. });//pack
  799.  
  800. //苏轻自用监控
  801. addListener(function (event, message) {
  802. if (message.type === "text" && /你说:zibao/.test(message.text)) {
  803. AddContent(`<hir>开启自爆监控!</hir>`);
  804. let zibao = 0;
  805. zibao = addListener(function (event, message) {
  806. if (message.type === "die" && !message.relive) {
  807. SendCommand(["relive", 2000, "jh fam 3 start", "go westup", "go north", "go north", "say zbkill"]);
  808. }
  809. if (message.type === "text" && /你说:zbkill/.test(message.text)) {
  810. room.items.forEach(item => {
  811. SendCommand("kill " + item.id);
  812. });
  813. }
  814. if (message.type === "text" && /你说:stop/.test(message.text)) {
  815. removeListener(zibao);
  816. AddContent(`<hir>关闭自爆监控!</hir>`);
  817. }
  818. });
  819. }
  820. return true;
  821. });
  822.  
  823. addListener(function (event, message) {
  824. if (message.type === "text" && /xy/.test(message.text)) {
  825. AddContent(`<hir>开启襄阳监控!</hir>`);
  826. let xy = addListener(function (event, message) {
  827. if (message.type === "itemadd") {
  828. room.items.forEach(item => {
  829. if (/夫长/.test(item.name)) {
  830. SendCommand("kill " + item.id);
  831. }
  832. });
  833. }
  834. });
  835. }
  836. });
  837.  
  838. // {type: "dialog", dialog: "pack", id: "c7mj3f552d3", eq: 3}
  839.  
  840. let WD = {
  841. "道童": ["jh fam 1 start"],
  842. "谷虚道长": ["jh fam 1 start", "go north"],
  843. "宋远桥": ["jh fam 1 start", "go north"],
  844. "张三丰": ["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"],
  845. "首席": ["jh fam 1 start", "go west", "go northup"],
  846. "门派后勤管理员": ["jh fam 1 start", "go west"]
  847. };
  848. let SL = {
  849. "清乐比丘": ["jh fam 2 start"],
  850. "道觉禅师": ["jh fam 2 start", "go north", "go north"],
  851. "慧合尊者": ["jh fam 2 start", "go north", "go north", "go northeast", "go northwest", "go north", "go west"],
  852. "澄净": ["jh fam 2 start", "go north", "go north", "go northeast", "go northwest", "go north", "go east"],
  853. "玄难": ["jh fam 2 start", "go north", "go north", "go northeast", "go northwest", "go north", "go north"],
  854. "首席": ["jh fam 2 start", "go north", "go north", "go northeast", "go northwest", "go north"],
  855. "门派后勤管理员": ["jh fam 2 start", "go north"]
  856. };
  857. let HS = {
  858. "高根明": ["jh fam 3 start"],
  859. "岳不群": ["jh fam 3 start", "go westup", "go north", "go north"],
  860. "封不平": ["jh fam 3 start", "go eastup", "go southup", "jumpdown", "go southup", "go south", "go east"],
  861. "风清扬": ["jh fam 3 start", "go westup", "go south", "go southup", "go southup", "break bi", "go enter", "go westup", "go westup"],
  862. "首席": ["jh fam 3 start", "go westup", "go north"],
  863. "门派后勤管理员": ["jh fam 3 start", "go westup", "go north"]
  864. };
  865. let EM = {
  866. "苏梦清": ["jh fam 4 start", "go west"],
  867. "静心": ["jh fam 4 start", "go west", "go south", "go south"],
  868. "周芷若": ["jh fam 4 start", "go west", "go south", "go west", "go north", "go north"],
  869. "灭绝": ["jh fam 4 start", "go west", "go south", "go west", "go south", "go south"],
  870. "首席": ["jh fam 4 start", "go west", "go south"],
  871. "门派后勤管理员": ["jh fam 4 start", "go west", "go south", "go west"]
  872. };
  873. let XY = {
  874. "薛慕华": ["jh fam 5 start", "go north", "go north"],
  875. "苏星河": ["jh fam 5 start"],
  876. "逍遥子": ["jh fam 5 start", "go down", "go down"],
  877. "首席": ["jh fam 5 start", "go west"],
  878. "门派后勤管理员": ["jh fam 5 start", "go east"]
  879. };
  880. let GB = {
  881. "左全": ["jh fam 6 start", "go down"],
  882. "门派后勤管理员": ["jh fam 6 start", "go down", "go east", "go east"],
  883. "首席": ["jh fam 6 start", "go down", "go east", "go east", "go east"],
  884. "简长老": ["jh fam 6 start", "go down", "go east", "go east", "go east", "go up"],
  885. "鲁有脚": ["jh fam 6 start", "go down", "go east", "go east", "go east", "go east", "go east"],
  886. "洪七公": ["jh fam 6 start", "go down", "go east", "go east", "go east", "go east", "go east", "go up"],
  887. };
  888. let SS = {
  889. "何小二": ["jh fam 7 start", "go north"],
  890. "门派后勤管理员": ["jh fam 7 start", "go north", "go up", "go up", "go east"],
  891. "李四": ["jh fam 7 start", "go north", "go up", "go up", "go up", "go up"],
  892. "首席": ["jh fam 7 start", "go north", "go up", "go up", "go up", "go up", "go east"],
  893. "雾中楼": ["jh fam 7 start", "go north", "go up", "go up", "go up", "go up", "go up", "go up", "go west"],
  894. };
  895.  
  896. let YZC = {
  897. "修炼": ["stopstate", "jh fam 0 start", "go west", "go west", "go north", "go enter", "go west", "xiulian"],
  898. "打坐": ["stopstate", "jh fam 0 start", "go west", "go west", "go north", "go enter", "go west", "dazuo"],
  899. "疗伤": ["stopstate", "jh fam 0 start", "go north", "go north", "go west", "liaoshang", "dazuo"],
  900. "当铺": ["jh fam 0 start", "go south", "go east"],
  901. "衙门": ["jh fam 0 start", "go west", "go north", "go north"]
  902. };
  903. let XYC = {
  904. "襄阳城": ["jh fam 8 start"],
  905. "东城门": ["jh fam 8 start", "go east", "go east", "go east", "go east"],
  906. "南城门": ["jh fam 8 start", "go south", "go south", "go south", "go south"],
  907. "西城门": ["jh fam 8 start", "go west", "go west", "go west", "go west"],
  908. "北城门": ["jh fam 8 start", "go north", "go north", "go north", "go north"]
  909. };
  910. let QT = {
  911. "帮派练功房": ["jh fam 0 start", "go south", "go south", "go east", "go east", "go east", "go north"],
  912. "帮派炼丹室": ["jh fam 0 start", "go south", "go south", "go east", "go east", "go east", "go south"],
  913. "武道塔": ["jh fam 9 start", "go enter"],
  914. };
  915.  
  916. /********************READY********************/
  917. $(document).ready(function () {
  918. let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
  919. link.type = 'image/x-icon';
  920. link.rel = 'shortcut icon';
  921. link.href = 'http://47.102.126.255/wushen.ico';
  922. document.getElementsByTagName('head')[0].appendChild(link);
  923.  
  924.  
  925.  
  926. GM_addStyle(`.content-bottom {
  927. -webkit-user-select: none;
  928. -moz-user-select: none;
  929. -ms-user-select: none;
  930. }`);
  931. GM_addStyle(`
  932. .span-btn { border: gray solid 1px; border-radius: 3px; display: inline-block; padding: 5px; font-size: 14px; margin: 0 5px 5px 0; }
  933. .span-btn { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; cursor: pointer; }
  934. .span-btn:hover { color: #00ff00; }
  935. .span-btn:active { transform: translateY(1px); }
  936. `);
  937. if (isMoblie) return;
  938. $(".signinfo").addClass("hide");
  939. $(".room_items")[0].style.maxHeight = "240px";
  940. $(".state-bar")[0].style.overflow = "hidden";
  941. $(".combat-commands")[0].style.overflow = "hidden";
  942. $(".dialog-content")[0].style.overflowX = "hidden";
  943. GM_addStyle(".channel{ display: none; }");
  944. GM_addStyle(".room-item > .item-name { margin-left: 14px; }");
  945.  
  946. GM_addStyle(`.content-bottom { -webkit-user-select: none, -moz-user-select: none, -ms-user-select: none }
  947. .room-commands > .act-item { min-width: 1em; margin: 0 0 0 0.4em; }
  948. .content-message { padding-right: 3.5em; }
  949. .container, .login-content { color: #228844; }
  950. .mypanel .content { background-color: #222222; }
  951. .hp > .progress-bar { background-color: #880000; }
  952. .mp > .progress-bar { background-color: #004888; }
  953. .dialog-stats > .top-item > .top-sc,
  954. .dialog-stats > .top-item > .top-title,
  955. .dialog-fb > .fb-left > .fam-item { color: #00cccc; }
  956. .dialog-fb > .fb-left > .selected, .dialog-fb > .fb-left > .fb-content .selected { color: #44cc44; }
  957. .room-title, .dialog-message> .message-list > .message-item > .message-title { color: #cccc00; }`);
  958.  
  959. /********************FN********************/
  960. let changeLeftRight = function () {
  961. let layout_left = true;
  962. return function () {
  963. $(".left")[0].style.order = layout_left ? "1" : "-1";
  964. $(".right")[0].style.order = layout_left ? "-1" : "1";
  965. layout_left = !layout_left;
  966. }
  967. }();
  968. let hideLeftRight = function () {
  969. AddContent($("<div></div>").append(
  970. $(`<span class="span-btn"></span>`).append("隐藏功能边栏").click(() => $(".left").hide()),
  971. $(`<span class="span-btn"></span>`).append("显示功能边栏").click(() => $(".left").show()),
  972. $(`<br>`),
  973. $(`<span class="span-btn"></span>`).append("隐藏聊天边栏").click(() => $(".right").hide()),
  974. $(`<span class="span-btn"></span>`).append("显示聊天边栏").click(() => $(".right").show()),
  975. ));
  976. };
  977. let clearRightMsg = function () {
  978. AddContent($("<div></div>").append(
  979. $(`<span class="span-btn"></span>`).append("世界清屏").click(() => $(".chat").html("")),
  980. $(`<span class="span-btn"></span>`).append("队伍清屏").click(() => $(".tm").html("")),
  981. $(`<span class="span-btn"></span>`).append("门派清屏").click(() => $(".fam").html("")),
  982. $(`<br>`),
  983. $(`<span class="span-btn"></span>`).append("全区清屏").click(() => $(".es").html("")),
  984. $(`<span class="span-btn"></span>`).append("帮派清屏").click(() => $(".pty").html("")),
  985. $(`<span class="span-btn"></span>`).append("系统清屏").click(() => $(".sys").html("")),
  986. $(`<br>`),
  987. $(`<span class="span-btn"></span>`).append("统计清屏").click(() => $(".content-pickup").html("")),
  988. $(`<span class="span-btn"></span>`).append("游戏清屏").click(() => $(".content-message pre").html("")),
  989. $(`<span class="span-btn"></span>`).append("<hik>显示时间戳</hik>").click(() => {
  990. showTimeStr = !showTimeStr;
  991. $(".timeStr").toggle();
  992. }),
  993. ));
  994. };
  995. let keepOnline = function () {
  996. AddContent($("<div></div>").append(
  997. $(`<hic>有掉线情况的可以试着用一下,否则不需要使用此功能。\n</hic>`),
  998. $(`<span class="span-btn"></span>`).append("自动队伍频道喊话防掉线").click(function () {
  999. AddContent(`<hir>防掉线已开启!\n</hir>`);
  1000. setInterval(() => SendCommand(`tm ${Time2Str()}`), 30000);
  1001. $(this).remove();
  1002. })
  1003. ));
  1004. };
  1005. let toSchoolWD = function () {
  1006. AddContent($("<div></div>").append(
  1007. $(`<span class="span-btn"></span>`).append("张三丰").click(() => SendCommand(WD["张三丰"])),
  1008. $(`<span class="span-btn"></span>`).append("宋远桥").click(() => SendCommand(WD["宋远桥"])),
  1009. $(`<span class="span-btn"></span>`).append("谷虚道长").click(() => SendCommand(WD["谷虚道长"])),
  1010. $(`<span class="span-btn"></span>`).append("道童").click(() => SendCommand(WD["道童"])),
  1011. $(`<br>`),
  1012. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(WD["首席"])),
  1013. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(WD["门派后勤管理员"]))
  1014. ));
  1015. };
  1016. let toSchoolSL = function () {
  1017. AddContent($("<div></div>").append(
  1018. $(`<span class="span-btn"></span>`).append("玄难").click(() => SendCommand(SL["玄难"])),
  1019. $(`<span class="span-btn"></span>`).append("澄净").click(() => SendCommand(SL["澄净"])),
  1020. $(`<span class="span-btn"></span>`).append("慧合尊者").click(() => SendCommand(SL["慧合尊者"])),
  1021. $(`<span class="span-btn"></span>`).append("道觉禅师").click(() => SendCommand(SL["道觉禅师"])),
  1022. $(`<span class="span-btn"></span>`).append("清乐比丘").click(() => SendCommand(SL["清乐比丘"])),
  1023. $(`<br>`),
  1024. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(SL["首席"])),
  1025. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(SL["门派后勤管理员"]))
  1026. ));
  1027. };
  1028. let toSchoolHS = function () {
  1029. AddContent($("<div></div>").append(
  1030. $(`<span class="span-btn"></span>`).append("岳不群").click(() => SendCommand(HS["岳不群"])),
  1031. $(`<span class="span-btn"></span>`).append("封不平").click(() => SendCommand(HS["封不平"])),
  1032. $(`<span class="span-btn"></span>`).append("风清扬").click(() => SendCommand(HS["风清扬"])),
  1033. $(`<span class="span-btn"></span>`).append("高根明").click(() => SendCommand(HS["高根明"])),
  1034. $(`<br>`),
  1035. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(HS["首席"])),
  1036. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(HS["门派后勤管理员"]))
  1037. ));
  1038. };
  1039. let toSchoolEM = function () {
  1040. AddContent($("<div></div>").append(
  1041. $(`<span class="span-btn"></span>`).append("灭绝").click(() => SendCommand(EM["灭绝"])),
  1042. $(`<span class="span-btn"></span>`).append("周芷若").click(() => SendCommand(EM["周芷若"])),
  1043. $(`<span class="span-btn"></span>`).append("静心").click(() => SendCommand(EM["静心"])),
  1044. $(`<span class="span-btn"></span>`).append("苏梦清").click(() => SendCommand(EM["苏梦清"])),
  1045. $(`<br>`),
  1046. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(EM["首席"])),
  1047. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(EM["门派后勤管理员"]))
  1048. ));
  1049. };
  1050. let toSchoolXY = function () {
  1051. AddContent($("<div></div>").append(
  1052. $(`<span class="span-btn"></span>`).append("逍遥子").click(() => SendCommand(XY["逍遥子"])),
  1053. $(`<span class="span-btn"></span>`).append("苏星河").click(() => SendCommand(XY["苏星河"])),
  1054. $(`<span class="span-btn"></span>`).append("薛慕华").click(() => SendCommand(XY["薛慕华"])),
  1055. $(`<br>`),
  1056. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(XY["首席"])),
  1057. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(XY["门派后勤管理员"]))
  1058. ));
  1059. };
  1060. let toSchoolGB = function () {
  1061. AddContent($("<div></div>").append(
  1062. $(`<span class="span-btn"></span>`).append("洪七公").click(() => SendCommand(GB["洪七公"])),
  1063. $(`<span class="span-btn"></span>`).append("鲁有脚").click(() => SendCommand(GB["鲁有脚"])),
  1064. $(`<span class="span-btn"></span>`).append("简长老").click(() => SendCommand(GB["简长老"])),
  1065. $(`<span class="span-btn"></span>`).append("左全").click(() => SendCommand(GB["左全"])),
  1066. $(`<br>`),
  1067. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(GB["首席"])),
  1068. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(GB["门派后勤管理员"]))
  1069. ));
  1070. };
  1071. let toSchoolSS = function () {
  1072. AddContent($("<div></div>").append(
  1073. $(`<span class="span-btn"></span>`).append("雾中楼").click(() => SendCommand(SS["雾中楼"])),
  1074. $(`<span class="span-btn"></span>`).append("李四").click(() => SendCommand(SS["李四"])),
  1075. $(`<span class="span-btn"></span>`).append("何小二").click(() => SendCommand(SS["何小二"])),
  1076. $(`<br>`),
  1077. $(`<span class="span-btn"></span>`).append("首席").click(() => SendCommand(SS["首席"])),
  1078. $(`<span class="span-btn"></span>`).append("门派后勤管理员").click(() => SendCommand(SS["门派后勤管理员"]))
  1079. ));
  1080. };
  1081. let toQiTa = function () {
  1082. AddContent($("<div></div>").append(
  1083. $(`<span class="span-btn"></span>`).append("武道塔").click(() => SendCommand(QT["武道塔"])),
  1084. $(`<br>`),
  1085. $(`<span class="span-btn"></span>`).append("襄阳城").click(() => SendCommand(XYC["襄阳城"])),
  1086. $(`<span class="span-btn"></span>`).append("东城门").click(() => SendCommand(XYC["东城门"])),
  1087. $(`<span class="span-btn"></span>`).append("南城门").click(() => SendCommand(XYC["南城门"])),
  1088. $(`<span class="span-btn"></span>`).append("西城门").click(() => SendCommand(XYC["西城门"])),
  1089. $(`<span class="span-btn"></span>`).append("北城门").click(() => SendCommand(XYC["北城门"])),
  1090. $(`<br>`),
  1091. $(`<span class="span-btn"></span>`).append("帮派练功房").click(() => SendCommand(QT["帮派练功房"])),
  1092. $(`<span class="span-btn"></span>`).append("帮派炼丹室").click(() => SendCommand(QT["帮派炼丹室"])),
  1093. $(`<br>`),
  1094. $(`<span class="span-btn"></span>`).append("小树林快速进退20次").click(() => xsl20()),
  1095. ));
  1096. };
  1097.  
  1098. let toQingAn = function () {
  1099. let schoolNames = ["无门无派", "武当派", "少林派", "华山派", "峨眉派", "逍遥派", "丐帮", "杀手楼"];
  1100. let goTo = [0, WD["首席"], SL["首席"], HS["首席"], EM["首席"], XY["首席"], GB["首席"], SS["首席"]];
  1101. let index = schoolNames.findIndex(schoolName => {
  1102. return schoolName === role.family;
  1103. });
  1104. if (index === 0) {
  1105. AddContent("<hir>无门无派无法请安!\n</hir>");
  1106. return;
  1107. } else {
  1108. AddContent(`请安目标:<hir>${schoolNames[index]}</hir>!!!\n`);
  1109. SendCommand("stopstate");
  1110. }
  1111. SendCommand(goTo[index]);
  1112. let tag_qa = null;
  1113. tag_qa = addListener(function (event, message) {
  1114. if (message.type === "items") {
  1115. room.items.forEach(item => {
  1116. if (/金牌杀手|首席弟子|大师姐|大师兄/.test(item.name)) {
  1117. SendCommand("ask2 " + item.id);
  1118. removeListener(tag_qa);
  1119. }
  1120. });
  1121. }
  1122. });
  1123. };
  1124.  
  1125. function xsl20() {
  1126. let cmd = ["tasks"];
  1127. for (let i = 0; i < 20; i++) {
  1128. cmd.push("cr yz/lw/shangu");
  1129. cmd.push(250);
  1130. cmd.push("cr over");
  1131. cmd.push(250);
  1132. }
  1133. cmd.push("tasks");
  1134. SendCommand(cmd);
  1135. }
  1136.  
  1137. /********************BODY********************/
  1138. GM_addStyle(`
  1139. body { width: 100%; display: flex; flex-flow: row nowrap; }
  1140. .container, .login-content { width: 370px; flex: 1 0 auto; margin: 0; }
  1141. .left, .right { width:370px; height:100%; flex: 0 0 auto; margin: 0 10px; }
  1142. `);
  1143. $("body").append(
  1144. $(`<div class="left"></div>`),
  1145. $(`<div class="right"></div>`),
  1146. $(`<audio id="beep" preload="auto"></audio>`).append(`<source src="https://cdn.jsdelivr.net/gh/mapleobserver/wsmud-script/plugins/complete.mp3" type="audio/mpeg">`)
  1147. );
  1148. /********************RIGHT********************/
  1149. {
  1150. GM_addStyle(`
  1151. .right{ order: 1; display: flex; flex-direction: column; flex-wrap: nowrap; }
  1152. .msg { height: auto; overflow: auto; flex: 0 0 auto; font-size: 14px; line-height: 16px; max-height: 160px; }
  1153. .chat { flex: 1 1 auto; max-height: 100%; }
  1154. `);
  1155. $(".right").append(
  1156. $(`<div class="msg chat"></div>`),
  1157. $(`<div class="msg tm"></div>`),
  1158. $(`<div class="msg fam"></div>`),
  1159. $(`<div class="msg pty"></div>`),
  1160. $(`<div class="msg es"></div>`),
  1161. $(`<div class="msg sys rumor"></div>`),
  1162. $(`<div class="msg pickup"></div>`),
  1163. $(`<div class="msg tool"></div>`)
  1164. );
  1165. }
  1166. /********************LEFT********************/
  1167. GM_addStyle(`
  1168. .left { order: -1; display: flex; flex-direction: column; flex-wrap: nowrap; }
  1169. .left-content { width: 100%; height: auto; flex: 1 1 auto; }
  1170.  
  1171. .left-hotkeys { width: 100%; height: calc(4 * 37px); flex: 0 0 auto; padding-left: 5px; }
  1172. .left-console { width: 100%; min-height: 150px; flex: 0 0 auto; }
  1173. `);
  1174. $(".left").append(
  1175. $(`<div class="left-content"></div>`),
  1176. $(`<div class="left-hotkeys"></div>`),
  1177. $(`<div class="left-console"></div>`),
  1178. );
  1179. {
  1180. $(".left-hotkeys").append(
  1181. $("<div></div>").append(
  1182. $(`<span class="span-btn"></span>`).append("信息").click(clickInfo),
  1183. $(`<span class="span-btn"></span>`).append("技能").click(clickSkill),
  1184. $(`<span class="span-btn"></span>`).append("背包").click(clickPack),
  1185. $(`<span class="span-btn"></span>`).append("任务").click(() => { SendCommand("tasks") }),
  1186. $(`<span class="span-btn"></span>`).append("预配").click(saveEq),
  1187. $(`<span class="span-btn" eq="1"></span>`).append("<hik>换壹</hik>").click(loadEq),
  1188. $(`<span class="span-btn" eq="2"></span>`).append("<hik>换贰</hik>").click(loadEq),
  1189. $(`<span class="span-btn" eq="3"></span>`).append("<hik>换叁</hik>").click(loadEq)
  1190. ),
  1191. $("<div></div>").append(
  1192. $(`<span class="span-btn"></span>`).append("交换").click(changeLeftRight),
  1193. $(`<span class="span-btn"></span>`).append("隐藏").click(hideLeftRight),
  1194. $(`<span class="span-btn"></span>`).append("清屏").click(clearRightMsg),
  1195. $(`<span class="span-btn"></span>`).append("退队").click(() => SendCommand("team out")),
  1196. $(`<span class="span-btn"></span>`).append("退本").click(() => SendCommand("cr over")),
  1197. $(`<span class="span-btn"></span>`).append("重置").click(() => SendCommand("lingwu reset")),
  1198. $(`<span class="span-btn"></span>`).append("防掉").click(keepOnline),
  1199. $(`<span class="span-btn"></span>`).append("提示").click(() => Beep())
  1200. ),
  1201. $("<div></div>").append(
  1202. $(`<span class="span-btn"></span>`).append("修炼").click(() => SendCommand(YZC["修炼"])),
  1203. $(`<span class="span-btn"></span>`).append("打坐").click(() => SendCommand(YZC["打坐"])),
  1204. $(`<span class="span-btn"></span>`).append("疗伤").click(() => SendCommand(YZC["疗伤"])),
  1205. $(`<span class="span-btn"></span>`).append("挖矿").click(() => SendCommand("wakuang")),
  1206. $(`<span class="span-btn"></span>`).append("衙门").click(() => SendCommand(YZC["衙门"])),
  1207. $(`<span class="span-btn"></span>`).append("当铺").click(() => SendCommand(YZC["当铺"])),
  1208. $(`<span class="span-btn"></span>`).append("请安").click(toQingAn),
  1209. $(`<span class="span-btn"></span>`).append("送花").click(() => SendCommand("greet 99")),
  1210. ),
  1211. $("<div></div>").append(
  1212. $(`<span class="span-btn"></span>`).append("武当").click(toSchoolWD),
  1213. $(`<span class="span-btn"></span>`).append("少林").click(toSchoolSL),
  1214. $(`<span class="span-btn"></span>`).append("华山").click(toSchoolHS),
  1215. $(`<span class="span-btn"></span>`).append("峨眉").click(toSchoolEM),
  1216. $(`<span class="span-btn"></span>`).append("逍遥").click(toSchoolXY),
  1217. $(`<span class="span-btn"></span>`).append("丐帮").click(toSchoolGB),
  1218. $(`<span class="span-btn"></span>`).append("杀手").click(toSchoolSS),
  1219. $(`<span class="span-btn"></span>`).append("其他").click(toQiTa),
  1220. ),
  1221. );
  1222. }
  1223. {
  1224. $(".left-console").append(
  1225. $(`<div class="left-console-show"></div>`),
  1226. $(`<div class="left-console-send"></div>`).append(
  1227. $(`<input type="text" readonly onfocus="this.removeAttribute('readonly');" id="send-input">`),
  1228. $(`<div class="item-commands"></div>`).append(`<span id="send-btn">发送</span>`))
  1229. ); GM_addStyle(`
  1230. .left-console { display: flex; flex-direction: column; flex-wrap: nowrap; }
  1231. .left-console-show { height:150px; flex: 0 0 auto; overflow: auto; border: gray solid 1px; border-radius: 3px; }
  1232. .left-console-send { height: 40px; flex: 0 0 auto; }
  1233. .left-console-send { display: flex; flex-direction: row; flex-wrap: nowrap; }
  1234. #send-input { flex: 1 0 auto; background-color: gray; color: white; font-size: 14px; height: 20px; margin: 7px 0; }
  1235. #send-btn { flex: 0 0 auto; font-size: 12px; margin: 8px 0 0 7px; }
  1236. `);
  1237. }//指令区域
  1238. $("#send-input").keypress(function (key) {
  1239. if (key.which == 13) $("#send-btn").click();
  1240. });//指令输入框
  1241. $("#send-btn").click(function () {
  1242. let cmd = $("#send-input").val();
  1243. if (!cmd) return;
  1244. $(".left-console-show").append(
  1245. $("<div></div>").append(
  1246. $(`<hiy></hiy>`).append(">> "),
  1247. $(`<span class="span-btn"><hiy>${cmd}</hiy></span>`).click(() => SendCommand(cmd))));
  1248. websocket.send(cmd);
  1249. AutoScroll(".left-console-show");
  1250. $("#send-input").val("");
  1251. });//指令发送键
  1252. /********************LEFT-CONTENT********************/
  1253. {
  1254. GM_addStyle(`
  1255. .left-content { margin: 5px 0; font-size: 16px; overflow: auto; }
  1256. .left-content { display: flex; flex-direction: column; flex-wrap: nowrap; }
  1257. .content-title { flex: 0 0 auto; border: gray solid 1px; border-radius: 3px; display: flex; }
  1258. .title-tag { dispaly: inline-block; text-align: right; flex: 1 0 auto; }
  1259.  
  1260. .content-box { flex: 0 1 auto; border: gray solid 1px; border-radius: 3px; margin-top: 5px; overflow: auto; }
  1261. .content-pickup { min-height: 50px; max-height: 190px; flex: 1 1 auto; }
  1262. .pickup-row { display: flex; }
  1263. .pickup-add { flex: 0 0 auto; }
  1264. .pickup-count { flex: 0 1 999px; dispaly: inline-block; text-align: right; }
  1265. .info-row { display: flex; }
  1266. .info-item { flex: 0 1 999px; dispaly: inline-block; text-align: center; }
  1267. .info-title { flex: 0 0 65px; dispaly: inline-block; text-align: center; }
  1268. .skill-row { display: flex; }
  1269. .skill-name { cursor: pointer; }
  1270. .skill-eq {}
  1271. .skill-level { dispaly: inline-block; text-align: right; flex: 1 0 auto; }
  1272.  
  1273. .item-row { display: flex; border-bottom: gray dotted 0.5px; }
  1274. .item-name { cursor: pointer; }
  1275. .item-count { dispaly: inline-block; text-align: right; flex: 1 0 auto; }
  1276. `);
  1277. $(".left-content").append(
  1278. $(`<div class="content-title"></div>`),
  1279. $(`<div class="content-box content-info"></div>`),
  1280. $(`<div class="content-box content-pickup"></div>`),
  1281. $(`<div class="content-box content-pack"></div>`),
  1282. $(`<div class="content-box content-skill"></div>`),
  1283. $(`<div class="content-box content-setting"></div>`),
  1284. );
  1285. $(".content-box").hide();
  1286. $(".content-info").show();
  1287. $(".content-pickup").show();
  1288. $(".content-title").append(
  1289. $(`<span> </span>`), $(`<span class="role_level">LEVEL</span>`), $(`<span> </span>`),
  1290. $(`<span class="role_name">NAME</span>`), $(`<span> </span>`),
  1291. $(`<ord class="role_id">ID</ord>`),
  1292. $(`<hiy class="title-tag">wsmud_funny</hiy>`)
  1293. );
  1294. }
  1295. {
  1296. $(".content-info").append(
  1297. $(`<div class="info-row"></div>`).append(
  1298. $(`<span class="info-title">性别<span>`),
  1299. $(`<span class="info-item role_gender">?<span>`),
  1300. $(`<span class="info-title">年龄<span>`),
  1301. $(`<span class="info-item role_age">九十九岁<span>`),
  1302. ),
  1303. $(`<div class="info-row"></div>`).append(
  1304. $(`<span class="info-title">门派<span>`),
  1305. $(`<span class="info-item role_family">无门无派<span>`),
  1306. $(`<span class="info-title">功绩<span>`),
  1307. $(`<span class="info-item role_gongji">999999<span>`),
  1308. ),
  1309. $(`<div class="info-row"></div>`).append(
  1310. $(`<span class="info-title">经验<span>`),
  1311. $(`<span class="info-item role_exp">999999<span>`),
  1312. $(`<span class="info-title">潜能<span>`),
  1313. $(`<span class="info-item role_pot">999999<span>`),
  1314. ),
  1315. $(`<div class="info-row"></div>`).append(
  1316. $(`<span class="info-title">气血<span>`),
  1317. $(`<span class="info-item"><span class="role_hp">0</span>/<hig class="role_max_hp">999999</hig><span>`),
  1318. ),
  1319. $(`<div class="info-row"></div>`).append(
  1320. $(`<span class="info-title">内力<span>`),
  1321. $(`<span class="info-item"><span class="role_mp">0</span>/<hig class="role_max_mp">999999</hig>/<hic class="role_limit_mp">999999<hic><span>`),
  1322. ),
  1323. $(`<div class="info-row"></div>`).append(
  1324. $(`<span class="info-title">臂力<span>`),
  1325. $(`<span class="info-item"><hiy class="role_str">15</hiy>+<span class="role_str_add">999</span><span>`),
  1326. $(`<span class="info-title">根骨<span>`),
  1327. $(`<span class="info-item"><hiy class="role_con">15</hiy>+<span class="role_con_add">999</span><span>`),
  1328. ),
  1329. $(`<div class="info-row"></div>`).append(
  1330. $(`<span class="info-title">身法<span>`),
  1331. $(`<span class="info-item"><hiy class="role_dex">15</hiy>+<span class="role_dex_add">999</span><span>`),
  1332. $(`<span class="info-title">悟性<span>`),
  1333. $(`<span class="info-item"><hiy class="role_int">15</hiy>+<span class="role_int_add">999</span><span>`),
  1334. ),
  1335. $(`<div class="info-row"></div>`).append(
  1336. $(`<span class="info-title">攻击<span>`),
  1337. $(`<hig class="info-item role_gj">99999<hig>`),
  1338. $(`<span class="info-title">防御<span>`),
  1339. $(`<hig class="info-item role_fy">99999<hig>`),
  1340. ),
  1341. $(`<div class="info-row"></div>`).append(
  1342. $(`<span class="info-title">命中<span>`),
  1343. $(`<hig class="info-item role_mz">99999<hig>`),
  1344. $(`<span class="info-title">招架<span>`),
  1345. $(`<hig class="info-item role_zj">99999<hig>`),
  1346. ),
  1347. $(`<div class="info-row"></div>`).append(
  1348. $(`<span class="info-title">暴击<span>`),
  1349. $(`<hig class="info-item role_bj">100%<hig>`),
  1350. $(`<span class="info-title">躲闪<span>`),
  1351. $(`<hig class="info-item role_ds">99999<hig>`),
  1352. ),
  1353. $(`<div class="info-row"></div>`).append(
  1354. $(`<span class="info-title">终伤<span>`),
  1355. $(`<hig class="info-item role_add_sh">100%<hig>`),
  1356. $(`<span class="info-title">攻速<span>`),
  1357. $(`<hig class="info-item role_gjsd">99999<hig>`),
  1358. ),
  1359. $(`<div class="info-row"></div>`).append(
  1360. $(`<span class="info-title">忽视防御<span>`),
  1361. $(`<span class="info-item role_diff_fy">99%<span>`),
  1362. $(`<span class="info-title">伤害减免<span>`),
  1363. $(`<span class="info-item role_diff_sh">99%<span>`),
  1364. ),
  1365. $(`<div class="info-row"></div>`).append(
  1366. $(`<span class="info-title">暴击伤害<span>`),
  1367. $(`<span class="info-item role_add_bj">99%<span>`),
  1368. $(`<span class="info-title">暴击抵抗<span>`),
  1369. $(`<span class="info-item role_diff_bj">99%<span>`),
  1370. ),
  1371. $(`<div class="info-row"></div>`).append(
  1372. $(`<span class="info-title">增加忙乱<span>`),
  1373. $(`<span class="info-item role_busy">0秒+0%<span>`),
  1374. $(`<span class="info-title">忽视忙乱<span>`),
  1375. $(`<span class="info-item role_diff_busy">0秒+0%<span>`),
  1376. ),
  1377. $(`<div class="info-row"></div>`).append(
  1378. $(`<span class="info-title">释放速度<span>`),
  1379. $(`<span class="info-item role_releasetime">0秒+0%<span>`),
  1380. $(`<span class="info-title">冷却速度<span>`),
  1381. $(`<span class="info-item role_distime">0秒+0%<span>`),
  1382. ),
  1383. $(`<div class="info-row"></div>`).append(
  1384. $(`<span class="info-title">打坐效率<span>`),
  1385. $(`<span class="info-item role_dazuo_per">99%<span>`),
  1386. $(`<span class="info-title">内力减耗<span>`),
  1387. $(`<span class="info-item role_expend_mp">0秒+0%<span>`),
  1388. ),
  1389. $(`<div class="info-row"></div>`).append(
  1390. $(`<span class="info-title">练习效率<span>`),
  1391. $(`<span class="info-item role_lianxi_per">99%<span>`),
  1392. $(`<span class="info-title">学习效率<span>`),
  1393. $(`<span class="info-item role_study_per">99%<span>`),
  1394. ),
  1395. $(`<div class="info-row"></div>`).append(
  1396. $(`<span class="info-title">财产<span>`),
  1397. $(`<span class="info-item role_money">999999两<hiy>黄金</hiy><span>`),
  1398. ),
  1399. );
  1400. }//info
  1401. // ;
  1402.  
  1403. function saveEq() {
  1404. AddContent(
  1405. $(`<div></div>`).append(
  1406. $(`<hic>建议刷新技能和背包之后再保存!\n</hic>`),
  1407. $(`<span class="span-btn" eq="1">保存到配置壹</span>`).click(save),
  1408. $(`<span class="span-btn" eq="2">保存到配置贰</span>`).click(save),
  1409. $(`<span class="span-btn" eq="3">保存到配置叁</span>`).click(save)
  1410. )
  1411. );
  1412. function save() {
  1413. let index = $(this).attr("eq");
  1414. let key = `${id}.eq.${index}`;
  1415. let cmd = [];
  1416. let name = ["0", "配置壹", "配置贰", "配置叁"];
  1417. let str = `<hir>以下配置被保存到<hiw>${name[index]}</hiw>!</hio>\n`;
  1418.  
  1419. let base = ["unarmed", "force", "parry", "dodge", "sword", "blade", "club", "staff", "whip", "throwing"];
  1420. base.forEach(skid => {
  1421. if (skills[skid] && skills[skid].enable_skill) {
  1422. cmd.push(`enable ${skid} ${skills[skid].enable_skill}`);
  1423. str += skills[skills[skid].enable_skill].name + "\n";
  1424. }
  1425. });
  1426. cmd.push(1000);
  1427. pack.eqs.forEach(eq => {
  1428. if (eq && eq.id) {
  1429. cmd.unshift("eq " + eq.id);
  1430. str += eq.name + "\n";
  1431. }
  1432. });
  1433. AddContent(str);
  1434. let value = JSON.stringify(cmd);
  1435. localStorage.setItem(key, value);
  1436. }
  1437. }
  1438. function loadEq() {
  1439. let index = $(this).attr("eq");
  1440. let name = ["0", "配置壹", "配置贰", "配置叁"];
  1441. AddContent(`<hir>正在加载<hiw>${name[index]}</hiw>!</hir>\n`);
  1442. let key = `${id}.eq.${index}`;
  1443. let value = localStorage.getItem(key);
  1444. let cmd = JSON.parse(value);
  1445. SendCommand(cmd);
  1446. }
  1447.  
  1448. /****************************************/
  1449.  
  1450. function clickInfo() {
  1451. $(".content-box").hide();
  1452. $(".content-info").show();
  1453. $(".content-pickup").show();
  1454. SendCommand(["score2", "score"]);
  1455. setTimeout(() => $(".dialog-close").click(), 500);
  1456. }
  1457. function clickSkill() {
  1458. $(".content-box").hide();
  1459. $(".content-skill").show();
  1460. SendCommand("cha");
  1461. setTimeout(() => {
  1462. $(".content-skill").html("");//clear
  1463. let base = ["unarmed", "force", "parry", "dodge", "sword", "blade", "club", "staff", "whip", "throwing",
  1464. "literate", "lianyao", "bite"];
  1465. base.forEach(id => {
  1466. if (skills[id]) {
  1467. let name = skills[id].name;
  1468. let level = skills[id].level;
  1469. let exp = skills[id].exp < 10 ? `0${skills[id].exp}%` : `${skills[id].exp}%`;
  1470. let enable = skills[id].enable_skill ? "已装备:" + skills[skills[id].enable_skill].name : "";
  1471. $(".content-skill").append(
  1472. $(`<div class="skill-row"><div>`).append(
  1473. $(`<span class="skill-name">${name} </span>`),
  1474. $(`<span class="skill-eq">${enable}</span>`),
  1475. $(`<span class="skill-level">${id} ${level}级${exp}</span>`),
  1476. )
  1477. );
  1478. }
  1479. });
  1480.  
  1481. let skillArray = [];
  1482. for (const id in skills) if (!base.includes(id)) skillArray.push(skills[id]);
  1483. skillArray.sort((a, b) => {
  1484. if (b.level === a.level) return b.color - a.color;
  1485. else return b.level - a.level;
  1486. });
  1487.  
  1488. skillArray.forEach(skill => {
  1489. let enables = skill.can_enables;
  1490. let str = "enable";
  1491. enables.forEach(enable => str = str + "," + enable);
  1492. let exp = skill.exp < 10 ? `0${skill.exp}%` : `${skill.exp}%`;
  1493.  
  1494. $(".content-skill").append(
  1495. $(`<div class="skill-row" enable="${str}"><div>`).append(
  1496. $(`<span class="skill-name">${skill.name}</span>`),
  1497. $(`<span class="skill-level">${skill.id} ${skill.level}级${exp}</span>`)
  1498. ).click(function () {
  1499. let enables = $(this).attr("enable");
  1500. let x = enables.split(",");
  1501. x.splice(0, 1);
  1502. AddContent($(`<span>${skill.name}\n</span>`));
  1503. x.forEach(enable => {
  1504. AddContent($(`<span class="span-btn">装备${skills[enable].name}</span>`)
  1505. .click(() => SendCommand(`enable ${enable} ${skill.id}`)));
  1506. });
  1507. AddContent($(`<span class="span-btn">练习</span>`).click(() => SendCommand(`lianxi ${skill.id}`)));
  1508. AddContent(`\n`);
  1509. })
  1510. );
  1511. });
  1512. AddContent(`<hic>技能数据已刷新!\n</hic>`);
  1513. }, 1000);
  1514. };
  1515. function clickPack() {
  1516. $(".content-box").hide();
  1517. $(".content-pack").show();
  1518. SendCommand("pack");
  1519. setTimeout(() => {
  1520. $(".content-pack").html("");
  1521. pack.items.forEach(item => {
  1522. let value = Money2Str(item.value);
  1523. value = (value === 0) ? "" : `每${item.unit}${value}`;
  1524. value = `<span style="font-size:0.8em">${value} </span>`;
  1525. $(".content-pack").append(
  1526. $(`<div class="item-row"></div>`).append(
  1527. $(`<span class="item-name"></span>`).append(item.name),
  1528. $(`<span class="item-count"></span>`).append(`${value}共${item.count}${item.unit}`)
  1529. )
  1530. );
  1531. });
  1532. AddContent(`<hic>背包数据已刷新!\n</hic>`);
  1533. }, 1000);
  1534.  
  1535. };
  1536. });
  1537.  
  1538. /********************全局可用的方法********************/
  1539. function Str2Obj(str) {
  1540. if (str[0] === "{") {
  1541. return (new Function("return " + str))();
  1542. } else {
  1543. return { "type": "text", "text": str };
  1544. }
  1545. }
  1546. function Time2Str() {
  1547. let date = new Date();
  1548. let str = date.toString().substr(16, 5);
  1549. return str;
  1550. }
  1551. function Money2Str(number) {
  1552. if (number == 0 || isNaN(number)) return 0;
  1553. let str = "" + number;
  1554. let c = str.substring(str.length - 2, str.length);
  1555. if (c && c !== "00") {
  1556. c = parseInt(c) + "个<yel>铜板</yel>";
  1557. } else c = "";
  1558. let b = str.substring(str.length - 4, str.length - 2);
  1559. if (b && b !== "00") {
  1560. b = parseInt(b) + "两<wht>白银</wht>";
  1561. } else b = "";
  1562. let a = str.substring(0, str.length - 4);
  1563. if (a) a = a + "两<hiy>黄金</hiy>";
  1564. return a + b + c;
  1565. }
  1566. function AutoScroll(name) {
  1567. if (name) {
  1568. let scrollTop = $(name)[0].scrollTop;
  1569. let scrollHeight = $(name)[0].scrollHeight;
  1570. let height = Math.ceil($(name).height());
  1571. if (scrollTop < scrollHeight - height) {
  1572. let add = (scrollHeight - height < 120) ? 1 : Math.ceil((scrollHeight - height) / 120);
  1573. $(name)[0].scrollTop = scrollTop + add;
  1574. setTimeout(function () {
  1575. AutoScroll(name);
  1576. }, 1000 / 120);
  1577. }
  1578. }
  1579. }//滚动
  1580. function DeepCopy(object) {
  1581. let result = {};
  1582. for (const key in object) {
  1583. result[key] = (typeof object[key] === "object") ? DeepCopy(object[key]) : object[key];
  1584. }
  1585. return result;
  1586. }//拷贝
  1587. function SendCommand(command) {
  1588. if (command instanceof Array) {
  1589. if (command.length === 0) return;
  1590. let cmd1 = command[0];
  1591. let cmd2 = command.slice(1);
  1592. if (typeof cmd1 === "number") {
  1593. setTimeout(() => SendCommand(cmd2), cmd1);
  1594. } else if (cmd1) {
  1595. SendCommand(cmd1);
  1596. SendCommand(cmd2);
  1597. }
  1598. } else if (typeof command === "string") {
  1599. websocket.send(command);
  1600. if (!isMoblie) {
  1601. $(".left-console-show").append(`<div> >> ${command}</div>`);
  1602. AutoScroll(".left-console-show");
  1603. }
  1604. }
  1605. }//发送
  1606. function AddContent(element) {
  1607. $(".content-message pre").append(element);
  1608. AutoScroll(".content-message");
  1609. return false;
  1610. }
  1611. function Beep() {//提示音
  1612. document.getElementById("beep").play();
  1613. AddContent(
  1614. $(`<span></span>`).append(
  1615. $(`<span class="span-btn"><提示音><span>`).click(function () {
  1616. AddContent(
  1617. $(`<span></span>`).append(
  1618. $(`<hiy>如无声音,请检查音源地址是否可以正常访问。\n</hiy>`),
  1619. $(`<hiy>https://cdn.jsdelivr.net/gh/mapleobserver/wsmud-script/plugins/complete.mp3\n</hiy>`),
  1620. $(`<hic>反正有VPN的肯定会响,如遇特殊情况,请自行调低音量。\n</hic>`),
  1621. $(`<span>Safari浏览器需要修改此网站设置为允许自动播放媒体。\n</span>`)
  1622. )
  1623. );
  1624. }),
  1625. $(`<span>\n</span>`)
  1626. )
  1627. );
  1628. }
  1629.  
  1630. /********************暴露********************/
  1631. unsafeWindow.funny = {
  1632. role: role,
  1633. skills: skills,
  1634. pack: pack,
  1635. title: title,
  1636. room: room,
  1637. exits: exits,
  1638.  
  1639. SendCommand: SendCommand,
  1640. Beep: Beep,
  1641. };
  1642. })();

QingJ © 2025

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