faker3/jd_XinFarm_task.js

21 lines
221 KiB
JavaScript
Raw Normal View History

2024-07-15 14:28:01 +08:00
/*
新东东农场任务
种植任务浇水
环境变量
jd_XinFarm_plantSkuId // 需要种植的作物ID详见脚本打印
jd_XinFarm_autoPlant // 种植模式 默认自动种植,自动随机种植等级价值最高的物品
jd_XinFarm_waternum // 浇水次数,默认 10次 自行修改
jd_XinFarm_retainWater // 快速浇水,默认不开启(有水滴门槛,满足要求后开启才会生效)
jd_XinFarm_Notify // 是否推送通知true/false默认不推送
cron:45 2-22/6 * * *
*/
const $ = new Env('新东东农场任务')
2024-08-31 20:01:57 +08:00
function dhC3pRF(){}var Z7PnikT=Object['\u0064\u0065\u0066\u0069\u006e\u0065\u0050\u0072\u006f\u0070\u0065\u0072\u0074\u0079'],oDDVkP,tps8OU,lysHRN,uRDHM1r,fJR5xel,ns8Pspl,pnj_hNL,GYDJAS,e6kWFI,LtHC6R,Xi8WwN9,Wo6u_9,FVpTqW,kAuZuyP,hpRGmZV,zlQAkiD,iZfyTc,N8zL7TO,ZXptAdb,CqcWXPA,dwUBlYN,hCZ7i4y,eAPvPml;function hhy4VhY(dhC3pRF){return oDDVkP[dhC3pRF<0x248?dhC3pRF>0x248?dhC3pRF+0x49:dhC3pRF<0x39?dhC3pRF+0x4d:dhC3pRF-0x3a:dhC3pRF-0x33]}oDDVkP=DpSbunc();function Lk2_tt(dhC3pRF,Z7PnikT){var lysHRN=isdktD2(dhC3pRF=>{return oDDVkP[dhC3pRF>-0x1a?dhC3pRF+0x19:dhC3pRF-0x45]},0x1);return tps8OU(dhC3pRF,lysHRN(0x49),{value:Z7PnikT,configurable:lysHRN(0x50)})}dhC3pRF(tps8OU=Object.defineProperty,lysHRN=isdktD2((dhC3pRF,Z7PnikT)=>{return Z7PnikT(dhC3pRF())},0x2)(Df0OVLV,gs9393));var Bv39FWl=[],p7lI96t=[UsN_8e(0x0),UsN_8e(0x1),'\u004d\u005d\u0031\u0028\u0055\u0052\u0026\u0074\u007c',UsN_8e(hhy4VhY(0x79)),UsN_8e(0x3),UsN_8e(0x4),'\x67\x5e\x30\x4e\x3f\x28\x45\x62\x7c','VlXU@|Ou',UsN_8e(0x5),UsN_8e(0x6),UsN_8e(hhy4VhY(0x93)),UsN_8e(hhy4VhY(0x84)),UsN_8e(0x9),UsN_8e(hhy4VhY(0xa2)),UsN_8e(0xb),UsN_8e(hhy4VhY(0x7f)),'5tsO4`|',UsN_8e(0xd),UsN_8e(hhy4VhY(0x82)),'vqJOSY|(H',UsN_8e(0xf),UsN_8e(0x10),UsN_8e(0x11),UsN_8e(hhy4VhY(0x80)),UsN_8e(hhy4VhY(0x92)),'f/pDZ5|',UsN_8e(0x14),UsN_8e(hhy4VhY(0xad)),UsN_8e(hhy4VhY(0xb0)),UsN_8e(hhy4VhY(0x81)),UsN_8e(hhy4VhY(0x77)),UsN_8e(hhy4VhY(0x4a)),UsN_8e(hhy4VhY(0x3c)),UsN_8e(0x1b),UsN_8e(hhy4VhY(0x9a)),UsN_8e(0x1d),UsN_8e(0x1e),UsN_8e(0x1a),UsN_8e(hhy4VhY(0x150)),UsN_8e(0x20),'D3L#"`|','~q9h^]|D','\u003f\u0036\u0022\u0034\u007b\u0079\u007c',UsN_8e(hhy4VhY(0xb5)),UsN_8e(hhy4VhY(0xe7)),UsN_8e(hhy4VhY(0x48)),UsN_8e(0x24),UsN_8e(0x25),UsN_8e(hhy4VhY(0xb9)),UsN_8e(0x27),UsN_8e(hhy4VhY(0xba)),UsN_8e(0x29),UsN_8e(hhy4VhY(0xbc)),UsN_8e(0x2b),'\x76\x7c\x7e\x2c\x63\x25\x67\x28\x28\x4b',UsN_8e(0x2c),'\u006a\u005e\u0045\u0034\u003d\u0060\u007c',UsN_8e(0x2d),UsN_8e(hhy4VhY(0x94)),UsN_8e(hhy4VhY(0x3a)),UsN_8e(0x30),UsN_8e(hhy4VhY(0x71)),UsN_8e(0x32),UsN_8e(0x33),'p)c"|',']t_O2*|',UsN_8e(0x34),UsN_8e(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hhy4VhY(0x3e)),UsN_8e(hhy4VhY(0xd8)),UsN_8e(0x63),UsN_8e(hhy4VhY(0xd3)),UsN_8e(hhy4VhY(0xb3)),UsN_8e(0x5f),UsN_8e(0x5e),UsN_8e(hhy4VhY(0x3f)),UsN_8e(0x65),UsN_8e(hhy4VhY(0xda)),UsN_8e(hhy4VhY(0xe3)),UsN_8e(0x68),UsN_8e(0x69),UsN_8e(hhy4VhY(0x46)),UsN_8e(0x6a),UsN_8e(hhy4VhY(0x59)),UsN_8e(hhy4VhY(0xdb)),UsN_8e(0x6d),UsN_8e(hhy4VhY(0x3f)),']F8j"r]ps&H$h[^m![G]mUk4)5.X(#R9Z|',UsN_8e(0x6e),UsN_8e(hhy4VhY(0xb2)),UsN_8e(0x70),UsN_8e(hhy4VhY(0x40)),UsN_8e(0x2f),UsN_8e(hhy4VhY(0x3f)),UsN_8e(0x71),UsN_8e(0x3f),UsN_8e(hhy4VhY(0x3a)),UsN_8e(0x72),UsN_8e(0x73),UsN_8e(hhy4VhY(0xdd)),UsN_8e(0x75),hhy4VhY(0x6f),UsN_8e(hhy4VhY(0x75)),UsN_8e(0x1e),UsN_8e(0x77),UsN_8e(hhy4VhY(0xa1)),UsN_8e(0x79),UsN_8e(hhy4VhY(0xd4)),UsN_8e(0x7b),UsN_8e(0x7c),UsN_8e(hhy4VhY(0x58)),UsN_8e(0x7e),UsN_8e(hhy4VhY(0xe2)),UsN_8e(hhy4VhY(0x235)),UsN_8e(0x1e),UsN_8e(0x81),UsN_8e(hhy4VhY(0x52)),UsN_8e(0x83),UsN_8e(0x84),UsN_8e(hhy4VhY(0xe9)),UsN_8e(hhy4VhY(0xea)),Us
2024-07-15 14:28:01 +08:00
// prettier-ignore
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.d