更新通知
This commit is contained in:
parent
3f8d74e1d2
commit
058fc901e3
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1120a
|
// @version 0.1.1121a
|
||||||
// @description Torn UI翻译
|
// @description Torn UI翻译
|
||||||
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -698,6 +698,8 @@
|
|||||||
'你收到了花费 25 PT 买来的股票交易机。现在你可以进入股票市场并开始购买股票。',
|
'你收到了花费 25 PT 买来的股票交易机。现在你可以进入股票市场并开始购买股票。',
|
||||||
'You have received a Racing License in exchange for 50 points. You can now access the Race Track in the city.':
|
'You have received a Racing License in exchange for 50 points. You can now access the Race Track in the city.':
|
||||||
'你收到了花费 50 PT 买来的赛车执照。你现在可以进入城市的赛车场了。',
|
'你收到了花费 50 PT 买来的赛车执照。你现在可以进入城市的赛车场了。',
|
||||||
|
'You have been given a display cabinet for your 100 points. Now you can store special items there. Go to the items page to start using it.':
|
||||||
|
'你收到了花费 100 PT 买来的展示柜。现在你可以在那里储存特殊物品。进入物品页面,开始使用它。',
|
||||||
'successfully revived you.': ' 成功复活了你',
|
'successfully revived you.': ' 成功复活了你',
|
||||||
'Save': '保存',
|
'Save': '保存',
|
||||||
'Send': '发送',
|
'Send': '发送',
|
||||||
@ -715,6 +717,11 @@
|
|||||||
'中,且你会当他们等级提升时获得奖励。',
|
'中,且你会当他们等级提升时获得奖励。',
|
||||||
'You have used the reward bonus code {$} and have received a boost of +250 energy.':
|
'You have used the reward bonus code {$} and have received a boost of +250 energy.':
|
||||||
'你已使用奖励兑换码 {$},收到了 250 能量E。',
|
'你已使用奖励兑换码 {$},收到了 250 能量E。',
|
||||||
|
', the director of':
|
||||||
|
' (',
|
||||||
|
'MAN': '体力 (MAN)',
|
||||||
|
'END': '耐心 (END)',
|
||||||
|
'INT': '智力 (INT)',
|
||||||
};
|
};
|
||||||
const chatDict = {
|
const chatDict = {
|
||||||
'Global': '世界',
|
'Global': '世界',
|
||||||
@ -2434,7 +2441,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 通知翻译的开关
|
// 通知翻译的开关
|
||||||
if (!$('div#event-trans-msg').get(0)) {
|
if (!$('div#event-trans-msg').get(0) && !window.location.href.contains(/index\.php/)) {
|
||||||
msgBox(`<div id="event-trans-msg">翻译暂时不能覆盖全部通知。<br>
|
msgBox(`<div id="event-trans-msg">翻译暂时不能覆盖全部通知。<br>
|
||||||
如发现问题请发送通知并联系 <a href="profiles.php?XID=2687093">Woohoo[2687093]</a><br>
|
如发现问题请发送通知并联系 <a href="profiles.php?XID=2687093">Woohoo[2687093]</a><br>
|
||||||
<input type="checkbox" id="eventTransCheck" name="eventTransCheck" /><label for="eventTransCheck">开启通知翻译</label> 可能会出现卡顿,默认开启</div>`);
|
<input type="checkbox" id="eventTransCheck" name="eventTransCheck" /><label for="eventTransCheck">开启通知翻译</label> 可能会出现卡顿,默认开启</div>`);
|
||||||
@ -2549,31 +2556,21 @@
|
|||||||
* You were sent Duke's Safe from DUKE
|
* You were sent Duke's Safe from DUKE
|
||||||
* You were sent a Diamond Bladed Knife from charapower
|
* You were sent a Diamond Bladed Knife from charapower
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('were sent') >= 0) {
|
if ($(e).text().contains(/You were sent .+ from/)) {
|
||||||
if ($(e).text().split('from someone').length > 1) return; // todo 收到匿名发来的物资
|
// 数量 物品 信息
|
||||||
const isWithMsg = $(e).text().indexOf('message') >= 0;
|
// spl = [You were sent 1x Birthday Present from]
|
||||||
const msg = isWithMsg ? $(e).text().split(' with the message: ')[1] : null;
|
const spl = $(e).contents().get(0).nodeValue.trim().split(' ');
|
||||||
const wordsList = e.firstChild.nodeValue.split(' ');
|
const msgSpl = $(e).text().trim().split('with the message: ');
|
||||||
// 发送的数量
|
const num = /^\$[0-9,]+\b/.test(spl[3]) ? '' : spl[3].numWordTrans();
|
||||||
let number;
|
const item = num === '' ? spl[3] : spl.slice(4, -1).join(' ');
|
||||||
if (wordsList[3] === 'some' || wordsList[3][0] === 'a') // 收到一个可数的不可堆叠或不可数的东西
|
const msg = msgSpl[1] ? msgSpl[1] : null;
|
||||||
number = '1x';
|
e.childNodes[0].nodeValue = `你收到了 ${num} ${item},来自 `;
|
||||||
else if (wordsList[3][wordsList[3].length - 1] === 'x') // 收到可数的可堆叠东西
|
if (e.childNodes[2]) {
|
||||||
number = wordsList[3];
|
e.childNodes[2].nodeValue = `。`;
|
||||||
else
|
}
|
||||||
number = null;
|
if (msg) {
|
||||||
const item = number === null ? wordsList.slice(3, wordsList.length - 2) : wordsList.slice(4, wordsList.length - 2);
|
e.childNodes[2].nodeValue = `,附带信息:${msg}。`;
|
||||||
|
}
|
||||||
// 你收到了来自someone的【数量】物品,附带信息:xxx。
|
|
||||||
e.firstChild.nodeValue = '你收到了来自 ';
|
|
||||||
e.childNodes[2].nodeValue = ' 的 ';
|
|
||||||
if (number)
|
|
||||||
e.childNodes[2].nodeValue += number
|
|
||||||
e.childNodes[2].nodeValue += ' ' + item.join(' ');
|
|
||||||
if (isWithMsg)
|
|
||||||
e.childNodes[2].nodeValue += ',附带信息:' + msg;
|
|
||||||
//e.childNodes[2].nodeValue += '。';
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2795,6 +2792,45 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司职位变更
|
||||||
|
*/
|
||||||
|
if ($(e).text().contains(/, the director of .+, has/)) {
|
||||||
|
$(e).contents().each((i,e)=>{
|
||||||
|
if (e.nodeType === 3) {
|
||||||
|
if (eventsDict[e.nodeValue.trim()]) {
|
||||||
|
e.nodeValue = eventsDict[e.nodeValue.trim()];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 工资改变
|
||||||
|
if (e.nodeValue.contains(/wage/)) {
|
||||||
|
const money = e.nodeValue.trim().slice(27,-9);
|
||||||
|
e.nodeValue = ` 的老板) 将你的每日工资改为 ${money}。`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 职位改变
|
||||||
|
if (e.nodeValue.contains(/rank/)) {
|
||||||
|
const pos = e.nodeValue.trim().slice(27,-1);
|
||||||
|
e.nodeValue = ` 的老板) 将你的公司职位改为 ${pos}。`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.nodeValue.contains(/assigned/)) {
|
||||||
|
e.nodeValue = ` 的老板) 将你指派为新的公司老板。`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 火车
|
||||||
|
if (e.nodeValue.contains(/trained/)) {
|
||||||
|
const spl = e.nodeValue.trim().split(' ');
|
||||||
|
const pri = spl[10];
|
||||||
|
const sec = spl[13].slice(0,-1);
|
||||||
|
e.nodeValue = ` 的老板) 从公司训练了你。你获得了 50 ${eventsDict[pri]} 和 25 ${eventsDict[sec]}。`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 悬赏已被领取
|
* 悬赏已被领取
|
||||||
*/
|
*/
|
||||||
@ -2890,7 +2926,7 @@
|
|||||||
/**
|
/**
|
||||||
* 收到帮派的钱
|
* 收到帮派的钱
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('given $') >= 0) {
|
if ($(e).text().contains(/You were given \$[0-9,]+ from your faction/)) {
|
||||||
const money = e.firstChild.nodeValue.split(' ')[3];
|
const money = e.firstChild.nodeValue.split(' ')[3];
|
||||||
let isNamed = e.childNodes.length > 1;
|
let isNamed = e.childNodes.length > 1;
|
||||||
if (isNamed) {
|
if (isNamed) {
|
||||||
@ -2950,7 +2986,7 @@
|
|||||||
/**
|
/**
|
||||||
* 收到帮派的pt
|
* 收到帮派的pt
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('points from') >= 0) {
|
if ($(e).text().contains(/You were given [0-9,]+ points? from your faction/)) {
|
||||||
const pt = e.firstChild.nodeValue.split(' ')[3];
|
const pt = e.firstChild.nodeValue.split(' ')[3];
|
||||||
e.firstChild.nodeValue = '你得到了从帮派取出的 ' + pt + ' PT。'
|
e.firstChild.nodeValue = '你得到了从帮派取出的 ' + pt + ' PT。'
|
||||||
return;
|
return;
|
||||||
@ -3083,7 +3119,7 @@
|
|||||||
/**
|
/**
|
||||||
* 每月蓝星奖励
|
* 每月蓝星奖励
|
||||||
*/
|
*/
|
||||||
if ($(e).text().contains(/You found .+ and .+ on your doorstep\./)) {
|
if ($(e).text().contains(/You found .+ and .+ on your doorstep/)) {
|
||||||
const [item1, item2] = $(e).text().trim().slice(10, -18).split(' and ');
|
const [item1, item2] = $(e).text().trim().slice(10, -18).split(' and ');
|
||||||
const bookTitle = item2.contains(/a book titled/) ? item2.slice(15, -1) : null;
|
const bookTitle = item2.contains(/a book titled/) ? item2.slice(15, -1) : null;
|
||||||
|
|
||||||
@ -3106,6 +3142,23 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 求婚
|
||||||
|
*/
|
||||||
|
if ($(e).text().contains(/accepted your proposal, you are now engaged/)) {
|
||||||
|
const spouse = $(e).children(':first').text().trim();
|
||||||
|
if (e.childNodes[1]) {
|
||||||
|
e.childNodes[1].nodeValue = ` 接受了你的求婚,你现在和 ${spouse} 订婚了!前往`;
|
||||||
|
}
|
||||||
|
if (e.childNodes[2] && e.childNodes[2].firstChild) {
|
||||||
|
e.childNodes[2].firstChild.nodeValue = `这里`;
|
||||||
|
}
|
||||||
|
if (e.childNodes[3]) {
|
||||||
|
e.childNodes[3].nodeValue = `完成仪式。`;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 帮派职位变更
|
* 帮派职位变更
|
||||||
* Your position in
|
* Your position in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user