更新
This commit is contained in:
parent
d7aa4cf021
commit
e417311b81
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wuhu-torn-helper",
|
"name": "wuhu-torn-helper",
|
||||||
"version": "0.5.8",
|
"version": "0.5.9",
|
||||||
"description": "芜湖助手",
|
"description": "芜湖助手",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -9,15 +9,14 @@ import Global from "./Global";
|
|||||||
|
|
||||||
export default class Application {
|
export default class Application {
|
||||||
|
|
||||||
public main() {
|
public static main() {
|
||||||
let started = performance.now();
|
let started = performance.now();
|
||||||
|
|
||||||
WuhuBase.PDAExecute();
|
WuhuBase.PDAExecute();
|
||||||
WuhuBase.conditionInterrupt();
|
WuhuBase.conditionInterrupt();
|
||||||
|
|
||||||
let app = new WuHuTornHelper();
|
WuHuTornHelper.getInstance();
|
||||||
app.init();
|
|
||||||
// let glob = WuhuBase.glob;
|
|
||||||
ZhongIcon.getInstance();
|
ZhongIcon.getInstance();
|
||||||
|
|
||||||
Common.getInstance().resolve();
|
Common.getInstance().resolve();
|
||||||
|
|||||||
@ -55,13 +55,15 @@ export default class Log {
|
|||||||
private static saveLogs(...o) {
|
private static saveLogs(...o) {
|
||||||
o.forEach(item => {
|
o.forEach(item => {
|
||||||
if (typeof item === 'string') this.logs += item;
|
if (typeof item === 'string') this.logs += item;
|
||||||
else if (item) {
|
else if (item !== null && item !== undefined) {
|
||||||
let json = '{}';
|
let json = '{}';
|
||||||
|
let name = 'UNKNOWN_OBJECT'
|
||||||
try {
|
try {
|
||||||
json = JSON.stringify(item);
|
json = JSON.stringify(item);
|
||||||
|
name = Object.getPrototypeOf(item).constructor.name;
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
this.logs += ` [${ item.toString() }] [${ json }] `;
|
this.logs += ` [${ name }] [${ json }] `;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.logs += '\r\n';
|
this.logs += '\r\n';
|
||||||
|
|||||||
@ -17,10 +17,12 @@ import LotteryHelper from "./action/LotteryHelper";
|
|||||||
import TornStyleBlock from "./utils/TornStyleBlock";
|
import TornStyleBlock from "./utils/TornStyleBlock";
|
||||||
import PTHelper from "./action/PTHelper";
|
import PTHelper from "./action/PTHelper";
|
||||||
import StackHelper from "./action/StackHelper";
|
import StackHelper from "./action/StackHelper";
|
||||||
|
import BuyBeerHelper from "./action/BuyBeerHelper";
|
||||||
|
import XZMZ from "./action/XZMZ";
|
||||||
|
|
||||||
export default class UrlPattern extends WuhuBase {
|
export default class UrlPattern extends WuhuBase {
|
||||||
public resolve(): void {
|
public resolve(): void {
|
||||||
let { href, beer } = UrlPattern.glob;
|
let href = window.location.href;
|
||||||
// 捡垃圾助手
|
// 捡垃圾助手
|
||||||
if (href.includes('city.php') && WuhuConfig.get('cityFinder')) cityFinder();
|
if (href.includes('city.php') && WuhuConfig.get('cityFinder')) cityFinder();
|
||||||
|
|
||||||
@ -30,13 +32,15 @@ export default class UrlPattern extends WuhuBase {
|
|||||||
// 叠e助手
|
// 叠e助手
|
||||||
if (href.includes('gym.php')) StackHelper.getInstance();
|
if (href.includes('gym.php')) StackHelper.getInstance();
|
||||||
|
|
||||||
|
// 寻找木桩
|
||||||
|
if (href.includes('item.php?temp=4#xunzhaomuzhuang')) XZMZ.getInstance();
|
||||||
|
|
||||||
// 啤酒店
|
// 啤酒店
|
||||||
if (href.includes('shops.php?step=bitsnbobs')) {
|
if (href.includes('shops.php?step=bitsnbobs')) {
|
||||||
let block = new TornStyleBlock('啤酒助手').insert2Dom();
|
let block = new TornStyleBlock('啤酒助手').insert2Dom();
|
||||||
block.setContent(ADD_BEER_HEAD_HTML);
|
block.setContent(ADD_BEER_HEAD_HTML);
|
||||||
const msg_node = block.querySelector('#wh-msg');
|
const msg_node = block.querySelector('#wh-msg');
|
||||||
// 加入啤酒
|
// 加入啤酒
|
||||||
// CommonUtils.elementReady('ul.items-list').then(node => {
|
|
||||||
block.querySelector('button').addEventListener('click', e => {
|
block.querySelector('button').addEventListener('click', e => {
|
||||||
let node = document.querySelector('ul.items-list');
|
let node = document.querySelector('ul.items-list');
|
||||||
if (!node) {
|
if (!node) {
|
||||||
@ -69,7 +73,8 @@ export default class UrlPattern extends WuhuBase {
|
|||||||
let response = JSON.parse(responseText);
|
let response = JSON.parse(responseText);
|
||||||
if (data.includes('step=buyShopItem') && data.includes('ID=180') && response['success']) {
|
if (data.includes('step=buyShopItem') && data.includes('ID=180') && response['success']) {
|
||||||
new Alert('已检测成功购买啤酒');
|
new Alert('已检测成功购买啤酒');
|
||||||
beer.skip_today();
|
// Global.getInstance().beer.skip_today();
|
||||||
|
BuyBeerHelper.getInstance().skip_today();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -191,7 +196,7 @@ export default class UrlPattern extends WuhuBase {
|
|||||||
this.set('rw_faction', id);
|
this.set('rw_faction', id);
|
||||||
},
|
},
|
||||||
getFactionID: async function (apikey) {
|
getFactionID: async function (apikey) {
|
||||||
const response = await fetch('https://api.torn.com/faction/?selections=basic&key=' + apikey);
|
const response = await window.fetch('https://api.torn.com/faction/?selections=basic&key=' + apikey);
|
||||||
const res_obj = await response.json();
|
const res_obj = await response.json();
|
||||||
const faction_id = res_obj['ID'];
|
const faction_id = res_obj['ID'];
|
||||||
if (faction_id) {
|
if (faction_id) {
|
||||||
|
|||||||
@ -32,8 +32,4 @@ export default class WuhuBase extends Provider {
|
|||||||
if (window.WHTRANS) throw '已运行,退出';
|
if (window.WHTRANS) throw '已运行,退出';
|
||||||
window.WHTRANS = true;
|
window.WHTRANS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public toString() {
|
|
||||||
// return `[${ JSON.stringify(this) }]`;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@ -9,7 +9,8 @@ import COMMON_CSS from "../static/css/common.css";
|
|||||||
|
|
||||||
export default class WuHuTornHelper extends WuhuBase {
|
export default class WuHuTornHelper extends WuhuBase {
|
||||||
|
|
||||||
init() {
|
constructor() {
|
||||||
|
super();
|
||||||
Log.info('WuHuTornHelper初始化');
|
Log.info('WuHuTornHelper初始化');
|
||||||
WuhuBase.glob = Global.getInstance();
|
WuhuBase.glob = Global.getInstance();
|
||||||
let glob = WuHuTornHelper.glob;
|
let glob = WuHuTornHelper.glob;
|
||||||
@ -38,22 +39,33 @@ export default class WuHuTornHelper extends WuhuBase {
|
|||||||
// 监听fetch
|
// 监听fetch
|
||||||
const ori_fetch = window.fetch;
|
const ori_fetch = window.fetch;
|
||||||
window.fetch = async (url: string, init: RequestInit) => {
|
window.fetch = async (url: string, init: RequestInit) => {
|
||||||
if (url.contains('newsTickers')) {
|
let startTime = performance.now();
|
||||||
// 阻止获取新闻横幅
|
Log.info('FETCH调用:[' + url + ']');
|
||||||
return new Response('{}');
|
return new Promise(resolve => {
|
||||||
}
|
if (url.contains('newsTickers')) {
|
||||||
if (url.includes('google')) {
|
Log.info('阻止获取新闻横幅');
|
||||||
return new Response('{}');
|
resolve(new Response('{}'));
|
||||||
}
|
return;
|
||||||
const res = await ori_fetch(url, init);
|
}
|
||||||
// mini profile 翻译
|
if (url.includes('google')) {
|
||||||
if (url.includes('profiles.php?step=getUserNameContextMenu') && WuhuConfig.get('transEnable')) {
|
Log.info('阻止google相关请求');
|
||||||
setTimeout(() => miniprofTrans(), 200);
|
resolve(new Response('{}'));
|
||||||
}
|
return;
|
||||||
let clone = res.clone();
|
}
|
||||||
let text = await res.text();
|
ori_fetch(url, init).then(res => {
|
||||||
Log.info({ url, init, text });
|
// mini profile 翻译
|
||||||
return clone;
|
if (url.includes('profiles.php?step=getUserNameContextMenu') && WuhuConfig.get('transEnable')) {
|
||||||
|
setTimeout(() => miniprofTrans(), 200);
|
||||||
|
}
|
||||||
|
let clone = res.clone();
|
||||||
|
res.text().then(text => Log.info('FETCH响应,耗时' + ((performance.now() - startTime) | 0) + 'ms', {
|
||||||
|
url,
|
||||||
|
init,
|
||||||
|
text
|
||||||
|
}));
|
||||||
|
resolve(clone);
|
||||||
|
})
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
CommonUtils.addStyle(COMMON_CSS.replace('{{}}', performance.now().toString()));
|
CommonUtils.addStyle(COMMON_CSS.replace('{{}}', performance.now().toString()));
|
||||||
@ -78,6 +90,8 @@ export default class WuHuTornHelper extends WuhuBase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.dataLayer = null;
|
||||||
|
|
||||||
Log.info('WuHuTornHelper初始化结束');
|
Log.info('WuHuTornHelper初始化结束');
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -407,7 +407,7 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
// API 计算
|
// API 计算
|
||||||
if (select.checked) {
|
if (select.checked) {
|
||||||
const api_key = glob.isPDA ? glob.PDA_APIKey : window.localStorage.getItem('APIKey');
|
const api_key = glob.isPDA ? glob.PDA_APIKey : window.localStorage.getItem('APIKey');
|
||||||
fetch(`https://api.torn.com/user/?selections=bars,perks&key=${ api_key }`)
|
window.fetch(`https://api.torn.com/user/?selections=bars,perks&key=${ api_key }`)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data['error']) {
|
if (data['error']) {
|
||||||
@ -690,6 +690,13 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
safeKeeper();
|
safeKeeper();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 寻找木桩
|
||||||
|
list.push({
|
||||||
|
domType: 'button',
|
||||||
|
domId: '',
|
||||||
|
domText: '🪵 寻找木桩',
|
||||||
|
clickFunc: () => window.location.href = 'https://www.torn.com/item.php?temp=4#xunzhaomuzhuang'
|
||||||
|
});
|
||||||
// 更新历史
|
// 更新历史
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button', domId: '', domText: '🐞 更新历史', clickFunc: async () => {
|
domType: 'button', domId: '', domText: '🐞 更新历史', clickFunc: async () => {
|
||||||
@ -735,7 +742,7 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
pop.getElement().innerHTML = '';
|
pop.getElement().innerHTML = '';
|
||||||
pop.getElement().appendChild(tmp);
|
pop.getElement().appendChild(tmp);
|
||||||
// 本日不提醒
|
// 本日不提醒
|
||||||
pop.getElement().querySelector('#wh-qua-alarm-check-btn').addEventListener('click', () => glob.beer.skip_today());
|
pop.getElement().querySelector('#wh-qua-alarm-check-btn').addEventListener('click', () => Global.getInstance().beer.skip_today());
|
||||||
// 开发详情按钮
|
// 开发详情按钮
|
||||||
// if (Log.debug()) $zhongNode.setting_root.querySelector('button#wh-devInfo').onclick = () => {
|
// if (Log.debug()) $zhongNode.setting_root.querySelector('button#wh-devInfo').onclick = () => {
|
||||||
// const date = new Date();
|
// const date = new Date();
|
||||||
|
|||||||
@ -132,7 +132,7 @@ export default class LotteryHelper extends WuhuBase {
|
|||||||
}
|
}
|
||||||
await CommonUtils.ajaxFetch({
|
await CommonUtils.ajaxFetch({
|
||||||
url: window.addRFC('https://www.torn.com/loader.php?sid=lotteryPlay&step=buyTicket&lotteryID=' + lotteryType),
|
url: window.addRFC('https://www.torn.com/loader.php?sid=lotteryPlay&step=buyTicket&lotteryID=' + lotteryType),
|
||||||
method: 'get',
|
method: 'GET',
|
||||||
referrer: '/loader.php?sid=lottery',
|
referrer: '/loader.php?sid=lottery',
|
||||||
});
|
});
|
||||||
await InfoUtils.getInstance().sleep(this.mathUtils.getRandomInt(20, 50));
|
await InfoUtils.getInstance().sleep(this.mathUtils.getRandomInt(20, 50));
|
||||||
|
|||||||
85
src/class/action/XZMZ.ts
Normal file
85
src/class/action/XZMZ.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import WuhuBase from "../WuhuBase";
|
||||||
|
import XUNZHAOMUZHUANG_HTML from "../../static/html/xunzhaomuzhuang/index.html";
|
||||||
|
import * as MUZHUANG_ID_LIST_JSON from "../../static/json/muzhuang_id_list.json";
|
||||||
|
import Log from "../Log";
|
||||||
|
import CommonUtils from "../utils/CommonUtils";
|
||||||
|
import XUNZHAOMUZHUANG_CSS from "../../static/css/xunzhaomuzhuang.css";
|
||||||
|
import TornStyleBlock from "../utils/TornStyleBlock";
|
||||||
|
|
||||||
|
export default class XZMZ extends WuhuBase {
|
||||||
|
private readonly mainRoleContainer: HTMLElement;
|
||||||
|
private readonly IDList: number[];
|
||||||
|
private readonly btn: HTMLButtonElement;
|
||||||
|
private readonly tips: HTMLElement;
|
||||||
|
private counter: number;
|
||||||
|
|
||||||
|
public constructor() {
|
||||||
|
super();
|
||||||
|
CommonUtils.addStyle(XUNZHAOMUZHUANG_CSS);
|
||||||
|
this.mainRoleContainer = document.querySelector('div[role="main"]');
|
||||||
|
let block = new TornStyleBlock('寻找木桩');
|
||||||
|
block.setContent(XUNZHAOMUZHUANG_HTML);
|
||||||
|
this.mainRoleContainer.append(block.getBase());
|
||||||
|
this.IDList = MUZHUANG_ID_LIST_JSON.default;
|
||||||
|
this.btn = block.querySelector('#deadman-start-btn') as HTMLButtonElement;
|
||||||
|
this.tips = block.querySelector('#deadman_tips');
|
||||||
|
|
||||||
|
block.querySelector('#deadman-start-btn').addEventListener('click', () => {
|
||||||
|
this.mainRoleContainer.querySelector('#table-body').innerHTML = '';
|
||||||
|
this.btn.disabled = true;
|
||||||
|
this.StartSearch();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private StartSearch() {
|
||||||
|
this.counter = this.IDList.length;
|
||||||
|
const tips = this.tips;
|
||||||
|
tips.innerText = "---寻找中,长按目标名字弹出迷你档案---";
|
||||||
|
for (const id of this.IDList) {
|
||||||
|
this.SearchDeadman(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SearchDeadman(id) {
|
||||||
|
CommonUtils.ajaxFetch({
|
||||||
|
url: window.addRFC('https://www.torn.com/profiles.php?step=getProfileData&XID=' + id),
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((res) => {
|
||||||
|
this.counter--;
|
||||||
|
if (res.userStatus.status.type === 'ok') {
|
||||||
|
this.addRow({
|
||||||
|
player_id: res.user.userID,
|
||||||
|
name: res.userInformation.name,
|
||||||
|
level: res.userInformation.level
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.counter === 0) {
|
||||||
|
this.tips.innerText = "---寻找结束,等待60秒后重试---";
|
||||||
|
let countdown = 60;
|
||||||
|
let timer = window.setInterval(() => {
|
||||||
|
this.btn.innerHTML = (countdown--).toString();
|
||||||
|
if (countdown === 0) {
|
||||||
|
window.clearInterval(timer);
|
||||||
|
this.btn.disabled = false;
|
||||||
|
this.btn.innerHTML = '重新寻找';
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
Log.error(e)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private addRow(data) {
|
||||||
|
let $parentNode = this.mainRoleContainer.querySelector('#table-body'),
|
||||||
|
$node = '<tr data-id="' + data.player_id + '"></tr>';
|
||||||
|
$node += '<td style="border: 1px solid darkgray;padding:5px;text-align:center;">' + data.player_id + '</td>'
|
||||||
|
$node += `<td style="border: 1px solid darkgray;padding:5px;text-align:center;"><a href="/profiles.php?XID=${ data.player_id }">${ data.name }</a></td>`;
|
||||||
|
$node += '<td style="border: 1px solid darkgray;padding:5px;text-align:center;">' + data.level + '</td>'
|
||||||
|
$node += '<td style="border: 1px solid darkgray;padding:5px;text-align:center;"><a href="https://www.torn.com/loader.php?sid=attack&user2ID=' + data.player_id + '" target="_blank">攻击</a></td>'
|
||||||
|
$parentNode.insertAdjacentHTML('beforeend', $node)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,7 @@ import Log from "../Log";
|
|||||||
export default class Starter {
|
export default class Starter {
|
||||||
public static run(T): void {
|
public static run(T): void {
|
||||||
try {
|
try {
|
||||||
new T().main();
|
T.main();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Log.error(error);
|
Log.error(error);
|
||||||
Log.error('[Starter] trace: ', JSON.stringify({ error }));
|
Log.error('[Starter] trace: ', JSON.stringify({ error }));
|
||||||
|
|||||||
@ -130,7 +130,7 @@ export default class CommonUtils extends WuhuBase {
|
|||||||
req_params.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
req_params.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||||
req_params.body = body;
|
req_params.body = body;
|
||||||
}
|
}
|
||||||
return fetch(url, req_params);
|
return window.fetch(url, req_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,11 +5,11 @@ export default class TornStyleSwitch {
|
|||||||
private readonly randomId;
|
private readonly randomId;
|
||||||
|
|
||||||
constructor(label: string) {
|
constructor(label: string) {
|
||||||
this.randomId = MathUtils.getInstance().getRandomInt(0, 100)
|
this.randomId = MathUtils.getInstance().getRandomInt(100, 2000);
|
||||||
this.baseElement = document.createElement('span');
|
this.baseElement = document.createElement('span');
|
||||||
this.baseElement.id = 'WHSwitch' + this.randomId;
|
this.baseElement.id = 'WHSwitch' + this.randomId;
|
||||||
this.baseElement.innerHTML = `<input class="checkbox-css" type="checkbox" name="searchConditionNot" id="WHCheck${ this.randomId }">
|
this.baseElement.innerHTML = `<input class="checkbox-css" type="checkbox" id="WHCheck${ this.randomId }">
|
||||||
<label for="WHCheck${ this.randomId }" class="non-selection marker-css search-condition-not">${ label }</label>`;
|
<label for="WHCheck${ this.randomId }" class="non-selection marker-css">${ label }</label>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBase() {
|
public getBase() {
|
||||||
|
|||||||
@ -241,7 +241,7 @@ async function factionDeposit() {
|
|||||||
});
|
});
|
||||||
$(form).trigger('submit');
|
$(form).trigger('submit');
|
||||||
let dataStr = `ajax=true&step=armouryDonate&type=cash&amount=${ money }`;
|
let dataStr = `ajax=true&step=armouryDonate&type=cash&amount=${ money }`;
|
||||||
let res = await (await fetch(window.addRFC('https://www.torn.com/factions.php'), {
|
let res = await (await window.fetch(window.addRFC('https://www.torn.com/factions.php'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: dataStr,
|
body: dataStr,
|
||||||
headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded' }
|
headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||||
@ -260,7 +260,7 @@ async function companyDepositAnywhere() {
|
|||||||
let url = addRFC('https://www.torn.com/inputMoneyAction.php?step=generalAction');
|
let url = addRFC('https://www.torn.com/inputMoneyAction.php?step=generalAction');
|
||||||
let money = await fetchUtils.ajax(url, 'GET');
|
let money = await fetchUtils.ajax(url, 'GET');
|
||||||
if (money === '0') return;
|
if (money === '0') return;
|
||||||
let res = await (await fetch(addRFC('https://www.torn.com/companies.php?step=funds'), {
|
let res = await (await window.fetch(addRFC('https://www.torn.com/companies.php?step=funds'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
referrer: 'companies.php',
|
referrer: 'companies.php',
|
||||||
body: 'deposit=' + money,
|
body: 'deposit=' + money,
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default function priceWatcherHandle(isPDA: boolean, PDA_APIKey: string) {
|
|||||||
// pt价格监视
|
// pt价格监视
|
||||||
async function priceWatcherPt(apikey, lower_price, priceWatcher) {
|
async function priceWatcherPt(apikey, lower_price, priceWatcher) {
|
||||||
if (!priceWatcher['watch-pt-lower-id']) priceWatcher['watch-pt-lower-id'] = [];
|
if (!priceWatcher['watch-pt-lower-id']) priceWatcher['watch-pt-lower-id'] = [];
|
||||||
const res = await fetch('https://api.torn.com/market/?selections=pointsmarket&key=' + apikey);
|
const res = await window.fetch('https://api.torn.com/market/?selections=pointsmarket&key=' + apikey);
|
||||||
const obj = await res.json();
|
const obj = await res.json();
|
||||||
if (obj['pointsmarket']) {
|
if (obj['pointsmarket']) {
|
||||||
// 过滤低于价格的物品出售id
|
// 过滤低于价格的物品出售id
|
||||||
@ -55,7 +55,7 @@ async function priceWatcherPt(apikey, lower_price, priceWatcher) {
|
|||||||
async function priceWatcherXan(apikey, lower_price, priceWatcher) {
|
async function priceWatcherXan(apikey, lower_price, priceWatcher) {
|
||||||
// 初始化记录上一个条目的id,避免重复发送通知
|
// 初始化记录上一个条目的id,避免重复发送通知
|
||||||
if (!priceWatcher['watch-xan-lower-id']) priceWatcher['watch-xan-lower-id'] = '';
|
if (!priceWatcher['watch-xan-lower-id']) priceWatcher['watch-xan-lower-id'] = '';
|
||||||
const res = await fetch('https://api.torn.com/market/206?selections=bazaar&key=' + apikey);
|
const res = await window.fetch('https://api.torn.com/market/206?selections=bazaar&key=' + apikey);
|
||||||
const obj = await res.json();
|
const obj = await res.json();
|
||||||
if (obj['bazaar']) {
|
if (obj['bazaar']) {
|
||||||
const lowest_item = obj['bazaar'][0]
|
const lowest_item = obj['bazaar'][0]
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import popupMsg from "../utils/@deprecated/popupMsg";
|
|
||||||
import Alert from "../../class/utils/Alert";
|
import Alert from "../../class/utils/Alert";
|
||||||
import InfoUtils from "../../class/utils/InfoUtils";
|
import InfoUtils from "../../class/utils/InfoUtils";
|
||||||
import Log from "../../class/Log";
|
import Log from "../../class/Log";
|
||||||
|
import Popup from "../../class/utils/Popup";
|
||||||
|
|
||||||
// 守望者
|
// 守望者
|
||||||
export default function safeKeeper() {
|
export default function safeKeeper() {
|
||||||
let url = `https://www.torn.com/loader.php?sid=attackData&mode=json&step=poll&user2ID=`;
|
let url = `https://www.torn.com/loader.php?sid=attackData&mode=json&step=poll&user2ID=`;
|
||||||
let popup = popupMsg('<p>监测目标ID玩家的防御状态,找出隐身攻击者</p>', '守望者 (测试中)');
|
let popup = new Popup('<p>监测目标ID玩家的防御状态,找出隐身攻击者</p>', '守望者 (测试中)');
|
||||||
let p = document.createElement('p');
|
let p = document.createElement('p');
|
||||||
let uid: HTMLInputElement = document.createElement('input');
|
let uid: HTMLInputElement = document.createElement('input');
|
||||||
let start = document.createElement('button');
|
let start = document.createElement('button');
|
||||||
@ -42,17 +42,19 @@ export default function safeKeeper() {
|
|||||||
// 弹出窗口关闭时结束
|
// 弹出窗口关闭时结束
|
||||||
let popup_close = popup.close;
|
let popup_close = popup.close;
|
||||||
popup.close = () => {
|
popup.close = () => {
|
||||||
if (loop_id === null) popup_close();
|
if (loop_id === null) {
|
||||||
else new Alert('守望者运行中,请先停止', { timeout: 2 });
|
popup.close = popup_close;
|
||||||
|
popup.close();
|
||||||
|
} else new Alert('守望者运行中,请先停止', { timeout: 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.appendChild(p);
|
popup.getElement().appendChild(p);
|
||||||
popup.appendChild(uid);
|
popup.getElement().appendChild(uid);
|
||||||
popup.appendChild(start);
|
popup.getElement().appendChild(start);
|
||||||
popup.appendChild(stop);
|
popup.getElement().appendChild(stop);
|
||||||
popup.appendChild(self_target);
|
popup.getElement().appendChild(self_target);
|
||||||
popup.appendChild(attackers);
|
popup.getElement().appendChild(attackers);
|
||||||
popup.appendChild(records);
|
popup.getElement().appendChild(records);
|
||||||
|
|
||||||
start.addEventListener('click', () => {
|
start.addEventListener('click', () => {
|
||||||
if (loop_id !== null || !uid.value) return;
|
if (loop_id !== null || !uid.value) return;
|
||||||
@ -61,10 +63,10 @@ export default function safeKeeper() {
|
|||||||
uid.readOnly = true;
|
uid.readOnly = true;
|
||||||
p.innerHTML = '状态:已开 ✅';
|
p.innerHTML = '状态:已开 ✅';
|
||||||
let count = 0;
|
let count = 0;
|
||||||
loop_id = setInterval(async () => {
|
loop_id = window.setInterval(async () => {
|
||||||
// 记录当前循环的id
|
// 记录当前循环的id
|
||||||
let that_id = loop_id;
|
let that_id = loop_id;
|
||||||
let res = await (await fetch(url + uid.value, {
|
let res = await (await window.fetch(url + uid.value, {
|
||||||
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||||
referrer: "loader.php?sid=attack&user2ID=" + uid.value
|
referrer: "loader.php?sid=attack&user2ID=" + uid.value
|
||||||
})).text();
|
})).text();
|
||||||
@ -112,7 +114,7 @@ export default function safeKeeper() {
|
|||||||
start.disabled = false;
|
start.disabled = false;
|
||||||
stop.disabled = true;
|
stop.disabled = true;
|
||||||
uid.readOnly = false;
|
uid.readOnly = false;
|
||||||
clearInterval(loop_id);
|
window.clearInterval(loop_id);
|
||||||
loop_id = null;
|
loop_id = null;
|
||||||
p.innerHTML = '状态:已关 ❎';
|
p.innerHTML = '状态:已关 ❎';
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export default function ajaxFetch(opt) {
|
|||||||
req_params.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
req_params.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||||
req_params.body = body;
|
req_params.body = body;
|
||||||
}
|
}
|
||||||
return fetch(url, req_params);
|
return window.fetch(url, req_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AjaxFetchOpt {
|
interface AjaxFetchOpt {
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import Starter from "./class/provider/Starter";
|
import Starter from "./class/provider/Starter";
|
||||||
import Application from "./class/Application";
|
import Application from "./class/Application";
|
||||||
|
|
||||||
// (function () {
|
Starter.run(Application);
|
||||||
Starter.run(Application)
|
|
||||||
// })();
|
|
||||||
@ -2,6 +2,6 @@ export default interface AjaxFetchOption {
|
|||||||
url: string,
|
url: string,
|
||||||
headers?: { 'X-Requested-With'?: string, 'Content-Type'?: string };
|
headers?: { 'X-Requested-With'?: string, 'Content-Type'?: string };
|
||||||
referrer?: string;
|
referrer?: string;
|
||||||
method?: string;
|
method?: 'GET' | 'POST';
|
||||||
body?: any;
|
body?: any;
|
||||||
}
|
}
|
||||||
3
src/static/css/xunzhaomuzhuang.css
Normal file
3
src/static/css/xunzhaomuzhuang.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.content-title, .info-msg-cont {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
29
src/static/html/xunzhaomuzhuang/index.html
Normal file
29
src/static/html/xunzhaomuzhuang/index.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<div id="deadman_div" style="width: inherit">
|
||||||
|
<div id="deadman_header" style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
|
||||||
|
<button class="torn-btn" id="deadman-start-btn" style="margin:5px;">开始寻找木桩</button>
|
||||||
|
</div>
|
||||||
|
<div id="deadman_tips" style="text-align:center; margin-bottom: 3px; font-size: 4px;">未开始</div>
|
||||||
|
<div id="deadman_wrapper"
|
||||||
|
style="min-height:700px;margin:10px 0px; border:1px solid darkgray; text-align:center;overflow:hidden;">
|
||||||
|
<table cellspacing="0" id="watchlist-table" style="width:100%; background-color: white; font-size:12px;">
|
||||||
|
<thead>
|
||||||
|
<th style="border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;">
|
||||||
|
ID
|
||||||
|
</th>
|
||||||
|
<th style="border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;">
|
||||||
|
名字
|
||||||
|
</th>
|
||||||
|
<th style="border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;">
|
||||||
|
等级
|
||||||
|
</th>
|
||||||
|
<th style="border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;">
|
||||||
|
攻击
|
||||||
|
</th>
|
||||||
|
<th style="border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;">
|
||||||
|
BS(M)
|
||||||
|
</th>
|
||||||
|
</thead>
|
||||||
|
<tbody id="table-body"></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
184
src/static/json/muzhuang_id_list.json
Normal file
184
src/static/json/muzhuang_id_list.json
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
[
|
||||||
|
17003,
|
||||||
|
251077,
|
||||||
|
340581,
|
||||||
|
313353,
|
||||||
|
498729,
|
||||||
|
279673,
|
||||||
|
353885,
|
||||||
|
514096,
|
||||||
|
753853,
|
||||||
|
458343,
|
||||||
|
464918,
|
||||||
|
491000,
|
||||||
|
237866,
|
||||||
|
451695,
|
||||||
|
953808,
|
||||||
|
162476,
|
||||||
|
802907,
|
||||||
|
800608,
|
||||||
|
342669,
|
||||||
|
67254,
|
||||||
|
147082,
|
||||||
|
792900,
|
||||||
|
275866,
|
||||||
|
112024,
|
||||||
|
365986,
|
||||||
|
264257,
|
||||||
|
464079,
|
||||||
|
342150,
|
||||||
|
372870,
|
||||||
|
14092,
|
||||||
|
905822,
|
||||||
|
654795,
|
||||||
|
575176,
|
||||||
|
815125,
|
||||||
|
983447,
|
||||||
|
330496,
|
||||||
|
436308,
|
||||||
|
1072681,
|
||||||
|
280295,
|
||||||
|
660205,
|
||||||
|
1180420,
|
||||||
|
478962,
|
||||||
|
382338,
|
||||||
|
229632,
|
||||||
|
488384,
|
||||||
|
465467,
|
||||||
|
381995,
|
||||||
|
342907,
|
||||||
|
332479,
|
||||||
|
190695,
|
||||||
|
346837,
|
||||||
|
79416,
|
||||||
|
432474,
|
||||||
|
378718,
|
||||||
|
1177887,
|
||||||
|
451753,
|
||||||
|
83039,
|
||||||
|
421949,
|
||||||
|
740967,
|
||||||
|
470180,
|
||||||
|
1082559,
|
||||||
|
644384,
|
||||||
|
484743,
|
||||||
|
281747,
|
||||||
|
1210736,
|
||||||
|
762865,
|
||||||
|
938350,
|
||||||
|
320161,
|
||||||
|
283188,
|
||||||
|
522960,
|
||||||
|
488552,
|
||||||
|
387822,
|
||||||
|
566484,
|
||||||
|
298167,
|
||||||
|
234429,
|
||||||
|
428732,
|
||||||
|
18798,
|
||||||
|
476620,
|
||||||
|
472351,
|
||||||
|
807823,
|
||||||
|
796316,
|
||||||
|
316768,
|
||||||
|
153910,
|
||||||
|
76096,
|
||||||
|
659852,
|
||||||
|
450465,
|
||||||
|
738073,
|
||||||
|
284536,
|
||||||
|
524912,
|
||||||
|
263120,
|
||||||
|
729174,
|
||||||
|
251566,
|
||||||
|
519062,
|
||||||
|
1489357,
|
||||||
|
669996,
|
||||||
|
191060,
|
||||||
|
454302,
|
||||||
|
684732,
|
||||||
|
1046495,
|
||||||
|
1199189,
|
||||||
|
485156,
|
||||||
|
1399310,
|
||||||
|
581300,
|
||||||
|
982173,
|
||||||
|
211286,
|
||||||
|
810355,
|
||||||
|
469582,
|
||||||
|
652354,
|
||||||
|
781161,
|
||||||
|
146715,
|
||||||
|
491724,
|
||||||
|
233040,
|
||||||
|
471136,
|
||||||
|
688148,
|
||||||
|
442427,
|
||||||
|
588113,
|
||||||
|
669588,
|
||||||
|
75522,
|
||||||
|
95057,
|
||||||
|
21631,
|
||||||
|
76480,
|
||||||
|
76583,
|
||||||
|
87572,
|
||||||
|
241909,
|
||||||
|
200728,
|
||||||
|
943004,
|
||||||
|
248808,
|
||||||
|
87461,
|
||||||
|
929257,
|
||||||
|
326028,
|
||||||
|
136660,
|
||||||
|
1514039,
|
||||||
|
34069,
|
||||||
|
556583,
|
||||||
|
130275,
|
||||||
|
173148,
|
||||||
|
247665,
|
||||||
|
320301,
|
||||||
|
264772,
|
||||||
|
583658,
|
||||||
|
813216,
|
||||||
|
41317,
|
||||||
|
50835,
|
||||||
|
14641,
|
||||||
|
222151,
|
||||||
|
26299,
|
||||||
|
340810,
|
||||||
|
27340,
|
||||||
|
54567,
|
||||||
|
228704,
|
||||||
|
359740,
|
||||||
|
185958,
|
||||||
|
374418,
|
||||||
|
316174,
|
||||||
|
431576,
|
||||||
|
244123,
|
||||||
|
188142,
|
||||||
|
1462209,
|
||||||
|
45179,
|
||||||
|
768356,
|
||||||
|
232564,
|
||||||
|
364079,
|
||||||
|
668705,
|
||||||
|
758810,
|
||||||
|
295155,
|
||||||
|
343321,
|
||||||
|
65146,
|
||||||
|
384786,
|
||||||
|
466947,
|
||||||
|
325378,
|
||||||
|
1278107,
|
||||||
|
463919,
|
||||||
|
930653,
|
||||||
|
380958,
|
||||||
|
349371,
|
||||||
|
184845,
|
||||||
|
931279,
|
||||||
|
355177,
|
||||||
|
228051,
|
||||||
|
545762,
|
||||||
|
507362,
|
||||||
|
28699
|
||||||
|
]
|
||||||
@ -2,6 +2,7 @@ import WuhuBase from "../class/WuhuBase";
|
|||||||
import Log from "../class/Log";
|
import Log from "../class/Log";
|
||||||
import Popup from "../class/utils/Popup";
|
import Popup from "../class/utils/Popup";
|
||||||
import TornStyleSwitch from "../class/utils/TornStyleSwitch";
|
import TornStyleSwitch from "../class/utils/TornStyleSwitch";
|
||||||
|
import CommonUtils from "../class/utils/CommonUtils";
|
||||||
|
|
||||||
export default class Test extends WuhuBase {
|
export default class Test extends WuhuBase {
|
||||||
public test(): void {
|
public test(): void {
|
||||||
@ -10,7 +11,7 @@ export default class Test extends WuhuBase {
|
|||||||
popup.getElement().append(new TornStyleSwitch('123').getBase());
|
popup.getElement().append(new TornStyleSwitch('123').getBase());
|
||||||
|
|
||||||
// this.case2()
|
// this.case2()
|
||||||
// this.case3();
|
this.case3().then();
|
||||||
}
|
}
|
||||||
|
|
||||||
private case1() {
|
private case1() {
|
||||||
@ -42,8 +43,10 @@ export default class Test extends WuhuBase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private case3() {
|
private async case3() {
|
||||||
let xmlhttp = new XMLHttpRequest();
|
Log.info(await CommonUtils.ajaxFetch({
|
||||||
xmlhttp.abort();
|
url: window.addRFC('https://www.torn.com/profiles.php?step=getProfileData&XID=17003'),
|
||||||
|
method: 'GET'
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user