diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js
index 5d15261..e198c3e 100644
--- a/torn-trans-zhcn.user.js
+++ b/torn-trans-zhcn.user.js
@@ -1,8 +1,8 @@
// ==UserScript==
-// @lastmodified 202202151825
+// @lastmodified 202202172332
// @name 芜湖助手
// @namespace WOOH
-// @version 0.3.11
+// @version 0.3.12
// @description 托恩,起飞!
// @author Woohoo[2687093] Sabrina_Devil[2696209]
// @match https://www.torn.com/*
@@ -23,13 +23,18 @@
if (window.WHTRANS) return;
window.WHTRANS = true;
// 版本
- const version = '0.3.11';
+ const version = '0.3.12';
// 修改历史
const changelist = [
{
todo: true,
cont: `翻译:baza npc商店、imarket、imarket搜索结果`,
},
+ {
+ ver: '0.3.12',
+ date: '20220217',
+ cont: `添加查看NNB功能,修复啤酒小助手的错误,调整显示飞花库存`,
+ },
{
ver: '0.3.11',
date: '20220215',
@@ -302,10 +307,12 @@
];
// iframe判断
const isIframe = self !== top;
- // jquery引入
+ // jQuery引入
const $ = window.jQuery;
- // pda api key
+ // PDA APIKey
const PDA_APIKey = '###PDA-APIKEY###';
+ // isPDA
+ const isPDA = PDA_APIKey.slice(-1) !== '#';
const titleDict = {
'Home': '主页',
@@ -3158,15 +3165,14 @@
{
// const date = new Date(2022, 11, 31, 23);
const date = new Date();
- // 欢迎
- const welcome_html = player_info.userID !== -1
- ? `欢迎 ${player_info.playername}[${player_info.userID}] 大佬`
- : '祝您旅途愉快';
- settingsArr.push({
- domType: 'plain',
- domId: 'wh-trans-welcome',
- domHTML: welcome_html,
- });
+ // 欢迎 显示玩家id
+ if (player_info.userID !== 0) {
+ settingsArr.push({
+ domType: 'plain',
+ domId: 'wh-trans-welcome',
+ domHTML: `欢迎 ${player_info.playername}[${player_info.userID}] 大佬`,
+ });
+ }
// 节日
let fest_date_html = ': ';
{
@@ -3347,8 +3353,8 @@
// 啤酒提醒
settingsArr.push({
domType: 'checkbox',
- domId: 'wh-15-alarm-check',
- domText: ' 啤酒提醒 ',
+ domId: 'wh-qua-alarm-check',
+ domText: ' 啤酒提醒 ',
dictName: '_15Alarm',
});
// 攻击链接转跳
@@ -3475,10 +3481,7 @@
});
// 自动开打和结束
settingsArr.push({
- domType: 'checkbox',
- domId: 'wh-auto-start-finish',
- domText: ' ⚠️自动开打和结束',
- dictName: 'autoStartFinish',
+ domType: 'checkbox', domId: 'wh-auto-start-finish', domText: ' ⚠️自动开打和结束', dictName: 'autoStartFinish',
});
} else {
wh_trans_settings.autoStartFinish = false;
@@ -3492,8 +3495,72 @@
domText: '飞花库存',
clickFunc: function (e) {
e.target.blur();
- const insert = `
`;
- popupMsg(insert, '飞花库存');
+ if (getScriptEngine() === UserScriptEngine.RAW) {
+ const insert = `
`;
+ popupMsg(insert, '飞花库存');
+ } else {
+ // addStyle('#wh-popup-cont td, #wh-popup-cont th{padding:4px;}');
+ const popup = popupMsg(`请稍后`, '飞花库存');
+ let table = `
+
| 目的地 - 更新时间 | 库存 | |||
|---|---|---|---|---|
| ${el.show} | ${update / 60 | 0}分${update % 60 | 0}秒前 | `; + let count = 0; + res.stocks[el.name]['stocks'].forEach(stock => { + if (el.stocks[stock.name]) { + table += `${el.stocks[stock.name]} (${stock['quantity']}) | `; + count++; + } + }); + while (count < 3) { + count++; + table += ''; + } + table += ' | |
NNB, Natural Nerve Bar, 意思是:扣除所有加成后,玩家本身的犯罪条上限,是衡量一个大佬犯罪技能等级的重要标准
+一般来说,左侧红色的犯罪条的上限都是包含加成的(称为Nerve Bar NB, 与NNB是不一样的),比如帮派、天赋等。额外的加成并不会影响玩家的犯罪技能
+查看NNB的方法很简单,在Torn主页面的最下方有一栏Perks,NB扣除增加的Nerve上限后就是NNB
+不想算?
+ + +You dug deep and completed 15 minutes of incline sprints
*You gained 1,854.05 speed
*/ - //$(e).attr('class').match(/gained/) if (gymDict[$(e).text()]) $(e).text(gymDict[$(e).text()]); }); @@ -5508,11 +5618,10 @@ display:none !important; if (wh_trans_settings.transEnable && window.location.href.contains(/(shops|bigalgunshop)\.php/)) { // 标题和右边的链接 const $cont_title = document.querySelector('.content-title'); - initOB($cont_title, {childList: true, subtree: true}, - () => { - titleTrans(); - contentTitleLinksTrans(); - }); + initOB($cont_title, {childList: true, subtree: true}, () => { + titleTrans(); + contentTitleLinksTrans(); + }); const $wrapper = document.querySelector('.content-wrapper'); // [购买部分] const $buy_items_wrapper = $wrapper.querySelector('.buy-items-wrap'); @@ -6633,17 +6742,14 @@ display:none !important; else if (spl.length === 1) { const upgraded = e.nodeValue.trim().slice(0, 60); const desc = e.nodeValue.trim().slice(61); - if (awDict[upgraded]) - e.nodeValue = awDict[upgraded]; - if (awDict[desc]) - e.nodeValue += awDict[desc]; + if (awDict[upgraded]) e.nodeValue = awDict[upgraded]; + if (awDict[desc]) e.nodeValue += awDict[desc]; } } }); // spend cancel按钮 $('ul#merits-list div.confirm-cont a').each((i, e) => { - if (awDict[$(e).text().trim()]) - $(e).text(awDict[$(e).text().trim()]); + if (awDict[$(e).text().trim()]) $(e).text(awDict[$(e).text().trim()]); }); }; awTrans(); @@ -6783,10 +6889,7 @@ display:none !important; contentTitleLinksTrans(); // 顶部提示信息 - $('div[class^="msg right-round"]').contents().each((i, e) => { - if (hosDict[e.nodeValue.trim()]) - e.nodeValue = hosDict[e.nodeValue.trim()]; - }); + $('div[class^="msg right-round"]').contents().each((i, e) => (hosDict[e.nodeValue.trim()]) && (e.nodeValue = hosDict[e.nodeValue.trim()])); //玩家列表标题 $('div[class^="users-list-title title-black top-round m-top10"] span').contents().each((i, e) => { @@ -7017,11 +7120,10 @@ display:none !important; if (wh_trans_settings.transEnable) { const $title_wrapper = $root.querySelector('div[class^="appHeaderWrapper___"]'); // 标题和右边的链接 - initOB($title_wrapper, {childList: true, subtree: true}, - () => { - titleTransReact(); - contentTitleLinksTransReact(); - }); + initOB($title_wrapper, {childList: true, subtree: true}, () => { + titleTransReact(); + contentTitleLinksTransReact(); + }); } // 解密攻略 if (wh_trans_settings.xmasTownWT) { @@ -7690,8 +7792,7 @@ margin: 0 0 3px; } e.childNodes[2].nodeValue += '你的最佳圈速是 ' + bestLap; - if (isBeat) - e.childNodes[2].nodeValue += ',比之前最佳 ' + record + ' 快 ' + bestBy; + if (isBeat) e.childNodes[2].nodeValue += ',比之前最佳 ' + record + ' 快 ' + bestBy; e.childNodes[2].nodeValue += '。' @@ -8200,8 +8301,7 @@ margin: 0 0 3px; * LSD od */ if ($(e).text().contains(/LSD .+ overdosed/)) { - if (eventsDict[$(e).text().trim()]) - $(e).text(eventsDict[$(e).text().trim()]); + if (eventsDict[$(e).text().trim()]) $(e).text(eventsDict[$(e).text().trim()]); return; } @@ -8408,8 +8508,7 @@ margin: 0 0 3px; function titleTrans() { const $title = $('h4#skip-to-content').length === 0 ? $('h4[class^="title"]') : $('h4#skip-to-content'); const title = titleDict[$title.text().trim()] || cityDict[$title.text().trim()]; - if (title && $title.css('display') !== 'none') - $title.after($title.clone().text(title)).css('display', 'none'); + if (title && $title.css('display') !== 'none') $title.after($title.clone().text(title)).css('display', 'none'); } function titleTransReact(dom = document.querySelectorAll('h4[class^="title___"]')) { @@ -8697,8 +8796,7 @@ margin: 0 0 3px; if (hasPopup()) return null; const popup = document.createElement('div'); popup.id = 'wh-popup'; - popup.innerHTML = - `${title}