diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index ca8f6db..7ff21d7 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -34,6 +34,7 @@ 'Received Events': '收到的通知', 'Saved Events': '保存的通知', 'Awards': '勋章', + 'Faction': '帮派', }; const titleLinksDict = { 'Personal stats': '个人统计信息', @@ -56,7 +57,9 @@ 'Hospital': '医院', 'Everyone': '所有人', 'Nobody': '仅自己', - 'Friends & faction': '好友 & 帮派成员' + 'Friends & faction': '好友 & 帮派成员', + 'Forum': '论坛', + 'Leave Faction': '离开帮派', }; const sidebarDict = { // todo 从json加载 'Money': '现金', @@ -498,7 +501,7 @@ 'Parameters:': '课程参数:', 'As the ultimate module - you will focus on maximum gym gain with the least amount of input.': '', 'Ability to withdraw and deliver blood': '抽取和输送血液的能力(使用血包)', - //'Gain {$1} {$2} upon completion': '获得{$1}点{$2}', + // 'Gain {$1} {$2} upon completion': '获得{$1}点{$2}', 'intelligence': '智力(INT)', 'endurance': '耐心(END)', 'manual labor': '体力(MAN)', @@ -658,15 +661,56 @@ 'Subtle':'', 'Transmission 1':'', 'Transmission 2':'', - 'Warble 1':'', - 'Warble 2':'', - 'Only people you know or have met':'只有你认识或遇到过的人', - 'Anyone can initiate chat with you':'任何人都可以主动与你聊天', - 'Recent':'最近', - 'Friends':'好友', - 'Blocked':'拉黑', - 'All':'全部', - 'Enter a name or ID to add to this list':'输入用户名或ID来添加到这个列表', + 'Warble 1': '', + 'Warble 2': '', + 'Only people you know or have met': '只有你认识或遇到过的人', + 'Anyone can initiate chat with you': '任何人都可以主动与你聊天', + 'Recent': '最近', + 'Friends': '好友', + 'Blocked': '拉黑', + 'All': '全部', + 'Enter a name or ID to add to this list': '输入用户名或ID来添加到这个列表', + }; + const hosDict = { + "You take a trip down to the hospital to see who's been unlucky today.": "你来了一趟医院,看看今天是谁那么倒霉", + "Nobody can revive you.": "现在没有玩家可以复活你", + "Anyone can now revive you.": "现在任何玩家都能复活你", + "Only those on your friends list & your faction members can now revive you.": "现在只有好友以及帮派成员可以复活你", + "in Hospital": "在住院", + "People are": "名玩家", + "Time": "时长", + "Level": "等级", + "Reason": "原因", + "Overdosed on Xanax": "吸食Xanax过量", + "Shot while attempting to take down a president": "在试图袭击总统时受了枪伤", + "Taken down by guards": "被保安击倒", + "Got a nasty surprise in the post.": "收到并打开了一个伤害性包裹", + "Dropped by Swiss Guards": "被瑞士警卫队抛下", + "Mauled by a guard dog": "被警卫犬袭击受伤", + "Collapsed after taking Ketamine": "服用Ketamine后昏倒", + "Collapsed after taking PCP": "服用PCP昏倒", + "Burned in an arson attempt": "在一次纵火案中被烧伤", + "Fallen ill with radiation poisoning": "因辐射中毒而病倒", + "Taken down by members of Aftermath": "被Aftermath的成员击倒了", + "Crashed his": "出车祸并撞毁了他的", + "Crashed her": "出车祸并撞毁了她的", + "Taken down by members of The Black Hand": "被黑手党成员拿下", + "Got derailed": "火车脱轨致伤", + "Third degree burns on back from explosion": "爆炸造成的背部三度烧伤", + "general": "被玩家 ", + "Hit in the head by flying metal": "被飞来的金属击中头部", + "Shot themselves in the foot": "打了自己腿一枪", + "Hospitalized by someone": "被某人殴打并送入医院", + "Attacked by someone": "被某人攻击", + "Mugged by someone": "被某人抢劫", + "Gunned down by FBI agents": "被联邦调查局特工枪击", + "Taken down by a SWAT marksman": "被一名特警射手击倒", + "Exploded": "被炸伤", + "Fell from a two story building while on a hitman mission": "在执行杀手任务时从两层的建筑坠落", + "Suffering from an acute hemolytic transfusion reaction": "患上了急性溶血性输血反应疾病", + "Choked out by Leslie": "被Leslie掐喉", + "Shot in the back": "背部中枪", + "Lost to": "输给了 ", }; const awDict = { 'Honors (':'荣誉 (', @@ -1632,7 +1676,7 @@ if (window.location.href.indexOf('level2.php') >= 0) { } - /* 医院页面 */ + /** 医院页面 **/ if (window.location.href.indexOf("hospitalview.php") >= 0) { const hospitalOB = new MutationObserver(hosOBInit); @@ -1643,34 +1687,6 @@ } function hospTrans() { - const hosDict = { - "You take a trip down to the hospital to see who's been unlucky today.": "你来了一趟医院,看看今天是谁那么倒霉", - "Nobody can revive you.": "现在没有玩家可以复活你", - "Anyone can now revive you.": "现在任何玩家都能复活你", - "Only those on your friends list & your faction members can now revive you.": "现在只有好友以及帮派成员可以复活你", - "in Hospital": "在住院", - "People are": "名玩家", - "Time": "时长", - "Level": "等级", - "Reason": "原因", - "Overdosed on Xanax": "吸食Xanax过量", - "Shot while attempting to take down a president": "在试图袭击总统时受了枪伤", - "Taken down by guards": "被卫兵拿下", - "Got a nasty surprise in the post.": "收到并打开了一个伤害性包裹", - "Dropped by Swiss Guards": "被瑞士警卫队丢弃", - "Mauled by a guard dog": "被警卫犬袭击受伤", - "Burned in an arson attempt": "在一次纵火案中被烧伤", - "Fallen ill with radiation poisoning": "因辐射中毒而病倒", - "Crashed his": "撞毁了他的", - "Crashed her": "撞毁了她的", - "Hospitalized by": "", - "Hospitalized by someone": "被某人殴打入院", - "Attacked by": "", - "Attacked by someone": "被某人攻击", - "Mugged by": "", - "Mugged by someone": "被某人抢劫", - "Exploded": "被炸伤" - } titleTrans(); contentTitleLinksTrans(); @@ -1688,10 +1704,30 @@ }) //玩家列表住院理由 - $('ul[class^="user-info-list-wrap"] span[class^="reason"]').contents().each((i, e) => { - let reasonStr = $(e).text().trim(); + $('ul[class^="user-info-list-wrap"] span[class^="reason"]').each((i, e) => { + let reasonStr = $(e).get(0).childNodes[1].nodeValue.trim(); + if (hosDict[reasonStr]) { - e.nodeValue = (hosDict[reasonStr]); + $(e)[0].childNodes[1].nodeValue = hosDict[reasonStr]; + } else if (reasonStr.indexOf("Crashed") >= 0) { + $(e)[0].childNodes[1].nodeValue = reasonStr + .replace("Crashed her", hosDict["Crashed her"]) + .replace("Crashed his", hosDict["Crashed his"]); + } else { + switch (reasonStr) { + case "Attacked by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 攻击"); + break; + case "Hospitalized by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 殴打并送入医院"); + break; + case "Mugged by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 抢劫"); + break; + } } }) } @@ -1701,6 +1737,91 @@ return; } + /** 帮派页面 **/ + if (window.location.href.indexOf("actions.php") >= 0) { + const factionOB = new MutationObserver(factionOBInit); + + function factionOBInit() { + factionOB.disconnect(); + factionTrans(); + factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + } + + const factionDict = { + "INFO": "信息", + "TERRITORY": "地盘", + "RANK": "名次", + "CRIMES": "组织犯罪", + "UPGRADES": "升级", + "ARMORY": "军械库", + "CONTROLS": "控制面板", + "FACTION": "帮派", + "YOUR FACTION IS NOT IN A WAR": "你的帮派没有处于战争状态", + "TIER": "级别", + "RESPECT": "声望", + "No active chain": "暂无攻击链", + "Main News": "主要消息", + "Attacking": "攻击", + "Funds": "资金流动", + "Armory": "军械库", + "Crimes": "组织犯罪", + "Membership": "成员资格", + "has claimed sovereignty of": "", + "has abandoned": "弃用了", + "Achieved a chain of": "达成了连击链值", + "and": "和", + "respect [": "点声望 [", + "deposited ${$1}": "存放了${$1}", + "Leadership was transferred to": "帮派领导权被移交给了 " + } + + function factionTrans() { + titleTrans(); + contentTitleLinksTrans(); + + //帮派大标题 + $('span[class^="tab-name"]').each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派战争状态 + $('div[class^="f-msg"]').contents().each((i, e) => { + let word2Trans = $(e).text().trim().split(":")[0]; + if (word2Trans && factionDict[word2Trans]) { + $(e).text($(e).text().replace(word2Trans, factionDict[word2Trans])); + } + }) + + //攻击链盒 + $('div[class^="chain-box"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派消息类别 + $('div[class^="newsHeader"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派主要消息日志 + $('ul[class^="news-list"] span[class^="info"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + e.nodeValue = e.nodeValue.replace($(e).text().trim(), factionDict[$(e).text().trim()]); + } + }) + + } + + factionTrans(); + factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + return; + } + /** * 通知翻译函数 * @param events