更新通知

This commit is contained in:
woohoo 2021-11-18 19:49:09 +08:00
parent 9d80ef1932
commit 7c90052609

View File

@ -678,6 +678,10 @@
'ALL EVENTS (': '全部通知 (',
'RECEIVED (': '收到的通知 (',
'SAVED (': '保存的通知 (',
'hospitalized': '强制住院了',
'and earned your': ',赢得',
'bounty reward': '赏金',
'Someone hospitalized': '某人强制住院了',
};
const chatDict = {
'Global': '世界',
@ -978,10 +982,10 @@
* 数词转换 a an some
*/
String.prototype.numWordTrans = function numWordTrans() {
return this.replace(/\ban\b/,'1 个')
.replace(/\ba\b/,'1 个')
.replace(/\bsome\b/,'1 个')
.replace(/(?<=[0-9])x\b/,' 个');
return this.replace(/\ban\b/, '1 个')
.replace(/\ba\b/, '1 个')
.replace(/\bsome\b/, '1 个')
.replace(/(?<=[0-9])x\b/, ' 个');
};
/**
@ -2609,6 +2613,27 @@
return;
}
/**
* 悬赏已被领取
*/
if ($(e).text().contains(/bounty reward/)) {
$(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(/bounty reward/)) {
const bountyAmount = e.nodeValue.trim().split(' ')[3];
if (eventsDict['and earned your'] && eventsDict['bounty reward']) {
e.nodeValue = ` ${eventsDict['and earned your']} ${bountyAmount} ${eventsDict['bounty reward']}`;
}
}
}
}
});
return;
}
/**
* oc开启
* You have been selected by
@ -2707,11 +2732,11 @@
* 帮派借东西
*/
if ($(e).text().contains(/loaned you .+ from the faction armory/)) {
const [num, item] = (()=>{
const spl=e.lastChild.nodeValue.trim().slice().slice(11, -25).split(' ');
return spl.length===1?[spl[0],null]:[spl[0],spl.slice(1).join(' ')];
const [num, item] = (() => {
const spl = e.lastChild.nodeValue.trim().slice().slice(11, -25).split(' ');
return spl.length === 1 ? [spl[0], null] : [spl[0], spl.slice(1).join(' ')];
})();
if (num&&item){
if (num && item) {
e.lastChild.nodeValue = ` 从帮派军械库中借给你 ${num.numWordTrans()} ${item}`;
}
return;
@ -2769,13 +2794,12 @@
* 每月蓝星奖励
*/
if ($(e).text().contains(/You found .+ and .+ on your doorstep\./)) {
const [item1, item2] = $(e).text().trim().slice(10,-18).split(' and ');
const bookTitle = item2.contains(/a book titled/)?item2.slice(15,-1):null;
const [item1, item2] = $(e).text().trim().slice(10, -18).split(' and ');
const bookTitle = item2.contains(/a book titled/) ? item2.slice(15, -1) : null;
if (bookTitle) {
$(e).text(`你在家门口发现了 ${item1.numWordTrans()} 和《${bookTitle}》。`);
}
else {
} else {
$(e).text(`你在家门口发现了 ${item1.numWordTrans()}${item2.numWordTrans()}`);
}
return;