// ==UserScript==
// @name iYdxx
// @version 0.1.4
// @description Min version, not pro. For YunDingXX, text MUD
// @match http://joucks.cn:3344/
// @match http://yundingxx.com:3344/
// @grant unsafeWindow
// @require https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js
// @require https://unpkg.com/element-ui@2.13.0/lib/index.js
// @namespace http://tampermonkey.net/
// @author gIrl1990
// @supportURL https://github.com/gMan1990/userscripts/issues
// ==/UserScript==
/*
Element (min)
https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css
https://unpkg.com/element-ui@2.13.0/lib/index.js
*/
jQuery(function($) {
document.getElementById("user-task").previousElementSibling.onclick = getUserTaskFunc;
document.body.onselectstart = null;
document.body.style.overflowY = "overlay";
$(document.head).append('');
let notify = function(message, type, duration, dangerouslyUseHTMLString) {
Vue.prototype.$notify({
message ,
type ,
duration ,
dangerouslyUseHTMLString ,
position : "bottom-right"
});
},
$options = $("#sellGoodsType>option");
if (!$options.length) {
return notify("插件注入失败: #sellGoodsType", "error", 0);
}
let sellGoodsT2,
/* Key-goods2 Map-order Val-goods2 */
sellGoodsType = new Map([ [ $options[0].value, {
t : $.text($options[0]),
i : 0
} ], [ "2", sellGoodsT2 = {
t : "-",
i : 1
} ], [ "5db663ba4682c5567589308c", {
t : "_鉴-武器",
i : 2,
p : sellGoodsT2
} ], [ "5db663be0d0236567c02b9b2", {
t : "_鉴-防具",
i : 3,
p : sellGoodsT2
} ] ]);
for (let i = 1; i < $options.length; i++) {
let v = sellGoodsType.get($options[i].value);
v ? (v.t = $.text($options[i]))
: sellGoodsType.set($options[i].value, {
t : $.text($options[i]),
i : sellGoodsType.size
});
}
/* 礼包-5df6e062a477cd1f36784c46 */
for (let v of [ "5e104150b0a1a420d1b56f6c", "5dfe09520162325366178d48", "5db663ad4682c5567589308a", "5df30563f551bc6dc6cdfc7b" ]) {
sellGoodsType.has(v) || sellGoodsType.set(v, {
t : v,
i : sellGoodsType.size
}); }
let tableColumnExpand = '\
\
\
\
使用 [${r.goods.name}] ${JSON.stringify(d.data)}
`); notify(JSON.stringify(d), "success", 4500, true); if (1 < lastIndex) { setTimeout(vm._useGoodsToUser, 350, r, --lastIndex); } else { vm.userGoodsErr = " "; } } else { this.error(x, d.msg); } }, error : function(x, t, e) { notify(`useGoodsToUser: ${e || t}`, "error", 9000); vm.userGoodsErr = " "; } }); }, makeGoods : function() { this.userGoodsErr = ""; /* lock */ let vm = this; $.ajax({ data : { sell_json : JSON.stringify(vm.$refs.t.store.states.selection.map(v => ({ id : v._id, count : vm.commGoodsNum }))), sell_type : "make" }, type : "POST", url : "/api/makeGoods", success : function(d, t, x) { if (200 == d.code) { for (let v of vm.$refs.t.store.states.selection) { v.count -= vm.commGoodsNum; } $log.prepend(`合成 [${d.data.goods.name}] *${d.data.count}
`); notify(JSON.stringify(d), "success"); vm.userGoodsErr = " "; } else { this.error(x, d.msg); } }, error : function(x, t, e) { notify(`makeGoods: ${e || t}`, "error", 9000); vm.userGoodsErr = " "; } }); }, wearUserEquipment : function(r) { this.userGoodsErr = ""; /* lock */ let vm = this; $.ajax({ data : { ueid : r.user_equipment._id, status : 0 }, type : "POST", url : "/api/wearUserEquipment", success : function(d, t, x) { if (200 == d.code) { r.count--; $log.prepend(`佩戴 [${d.data.name}]
`); notify(JSON.stringify(d), "success"); vm.userGoodsErr = " "; } else { this.error(x, d.msg); } }, error : function(x, t, e) { notify(`wearUserEquipment: ${e || t}`, "error", 9000); vm.userGoodsErr = " "; } }); }, byGoodsToMyUser : function(gid) { this.userGoodsErr = ""; /* lock */ this._byGoodsToMyUser(gid, this.commGoodsNum); }, _byGoodsToMyUser : function(gid, lastIndex) { let vm = this; $.ajax({ data : { gid }, type : "POST", url : "/api/byGoodsToMyUser", success : function(d, t, x) { if (200 == d.code) { $log.prepend(`购得 [${d.data.name}] *1 单价=${d.data.price}${vm.price_type[d.data.price_type]}
`); notify(JSON.stringify(d), "success"); if (1 < lastIndex) { setTimeout(vm._byGoodsToMyUser, 350, gid, --lastIndex); } else { vm.userGoodsErr = " "; } } else { this.error(x, d.msg); } }, error : function(x, t, e) { notify(`byGoodsToMyUser: ${e || t}`, "error", 9000); vm.userGoodsErr = " "; } }); } } }) }; });