diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e13ba0..3ec4a41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ # CHANGE +## 0.8.1 + +2023年02月01日 + +### 添加 + +- 上次动作的开关 + ## 0.8.0 2023年01月16日 diff --git a/package.json b/package.json index eb4e4da..3bec982 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wuhu-torn-helper", - "version": "0.8.0", + "version": "0.8.1", "description": "芜湖助手", "dependencies": {}, "scripts": { diff --git a/release.min.user.js b/release.min.user.js index b194299..aaa16f2 100644 --- a/release.min.user.js +++ b/release.min.user.js @@ -1,8 +1,8 @@ // ==UserScript== -// @lastmodified 202301181128 +// @lastmodified 202302010944 // @name 芜湖助手 // @namespace WOOH -// @version 0.8.0 +// @version 0.8.1 // @description 托恩,起飞! // @author Woohoo[2687093] Sabrina_Devil[2696209] // @match https://www.torn.com/* @@ -17,13 +17,13 @@ // @connect gitee.com // ==/UserScript== !function(){"use strict";class re{static info(...e){re.counter.info++;var t=this.getTime(),n="[WH] IFO";this.debug()&&console.log(n,t,...e),this.saveLogs(n,t,...e)}static error(...e){re.counter.error++;var t=this.getTime(),n="[WH] ERR";console.error(n,t,...e),this.saveLogs(n,t,...e)}static warn(...e){re.counter.warning++;var t=this.getTime(),n="[WH] WRN";this.debug()&&console.warn(n,t,...e),this.saveLogs(n,t,...e)}static debug(){let e=!0;try{var t=JSON.parse(localStorage.getItem("wh_trans_settings"));t&&(e=t.isDev)}catch(e){}return e}static getTime(){let e=new Date;return`[${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)} ${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}:${("0"+e.getSeconds()).slice(-2)}.${("00"+e.getMilliseconds()).slice(-3)}]`}static getLogs(){return this.logs}static saveLogs(...e){e.forEach(t=>{if("string"==typeof t)this.logs+=t;else if(null!=t){let e="{}";var n=Object.getPrototypeOf(t).constructor.name;try{e=JSON.stringify(t)}catch(e){}this.logs+=` [${n}] [${e}] `,t.message&&(this.logs+="错误信息: "+t.message),t.stack&&(this.logs+="错误堆栈: "+t.stack)}}),this.logs+="\r\n"}static getCounter(){return{info:re.counter.info,error:re.counter.error,warning:re.counter.warning}}}function y(e,r,s,l){return new(s=s||Promise)(function(n,t){function i(e){try{a(l.next(e))}catch(e){t(e)}}function o(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(i,o)}a((l=l.apply(e,r||[])).next())})}re.logs="",re.counter={info:0,error:0,warning:0};class m{constructor(){this.startTime=performance.now()}getTimeMs(){return(performance.now()-this.startTime|0)+"ms"}}class n{constructor(){this.className="Provider"}static getInstance(...t){if(!this.instance){let e=new m;this.instance=new this(...t);t=this.instance.getClassName()||this.name;re.info("实例已创建,",t,this.instance,"耗时"+e.getTimeMs()),n.pool[t]=this.instance}return this.instance}static getPool(){return{pool:n.pool}}}n.pool={};class s extends n{constructor(){super(...arguments),this.className="WuhuBase"}static getLocal(){let e;var t=localStorage.getItem("wh_trans_settings")||"{}";try{e=JSON.parse(t)}catch(e){re.error("解析localStorage对象出错",e),localStorage.setItem("wh_trans_settings","{}")}return e||{}}static conditionInterrupt(){let e=document.querySelector("#skip-to-content")||document.querySelector('[href*="#skip-to-content"]')||{innerText:""};if(document.title.toLowerCase().includes("just a moment")||e.innerText.toLowerCase().includes("please validate")||null!==document.querySelector("div.container div.cf .iAmUnderAttack"))throw"芜湖"}getClassName(){return this.className}}s.glob=null;class u extends s{constructor(e,t="芜湖助手"){super(),this.className="Popup",this.container=null,this.node=null,u.glob.popup_node&&(re.info("关闭前一个弹窗"),u.glob.popup_node.close()),re.info("新建弹窗",{innerHTML:e,title:t});const n=document.createElement("div");n.id="wh-popup",n.innerHTML='\n
{{}}
{{}}
监测目标ID玩家的防御状态,找出隐身攻击者
","守望者 (测试中)"),t=document.createElement("p"),r=document.createElement("input"),n=document.createElement("button"),i=document.createElement("button"),o=document.createElement("button"),l=document.createElement("div"),c=(l.obj={},document.createElement("div")),d=(c.list=[],c.details={},null),a=(r.type="text",r.placeholder="目标ID",n.innerHTML="开启",i.innerHTML="关闭",i.disabled=!0,o.innerHTML="填入自己",e.close);e.close=()=>{null===d?(e.close=a,e.close()):new E("守望者运行中,请先停止",{timeout:2})},e.getElement().appendChild(t),e.getElement().appendChild(r),e.getElement().appendChild(n),e.getElement().appendChild(i),e.getElement().appendChild(o),e.getElement().appendChild(l),e.getElement().appendChild(c),n.addEventListener("click",()=>{if(null===d&&r.value){n.disabled=!0,i.disabled=!1,r.readOnly=!0,t.innerHTML="状态:已开 ✅";let a=0;d=window.setInterval(()=>y(this,void 0,void 0,function*(){var i=d;let o=yield(yield window.fetch("https://www.torn.com/loader.php?sid=attackData&mode=json&step=poll&user2ID="+r.value,{headers:{"X-Requested-With":"XMLHttpRequest"},referrer:"loader.php?sid=attack&user2ID="+r.value})).text();if(d===i){i=JSON.parse(o.split("
'.replace("{{}}",performance.now().toString()),"飞花库存");else{const e=new u("请稍后 "+M.loading_gif_html(),"飞花库存");let i='| 目的地 - 更新时间 | 库存 | |||
|---|---|---|---|---|
| ${t.show} | ${e/60|0}分${e%60|0}秒前 | `;let n=0;for(a.stocks[t.name].stocks.forEach(e=>{t.stocks[e.name]&&(i+=`${t.stocks[e.name]} (${e.quantity}) | `,n++)});n<3;)n++,i+="";i+=" | |