diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index afaddd5..13bbd9c 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Torn翻译 // @namespace WOOH -// @version 0.1.1129a +// @version 0.1.1129b // @description Torn UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -56,9 +56,9 @@ 'Back to Education': '返回', 'Recruit Citizens': '招募玩家', 'Events': '通知', - 'Travel Home': "回国", - 'Rehabilitation': "戒毒康复", - 'People': "用户列表", + 'Travel Home': "返程", + 'Rehabilitation': "解毒康复", + 'People': "玩家列表", 'Computer': '电脑', 'Market': '市场', 'Back': '返回', @@ -1238,17 +1238,6 @@ 'I Industries Ltd.': '一号工业有限公司', 'Tell Group Plc.': '讲述集团', 'Yazoo': '', - // '1x Drug Pack': '', - // '1x Feathery Hotel Coupon': '', - // '1x Erotic DVD': '', - // '1x Six Pack of Energy Drink': '', - // '1x Clothing Cache': '', - // '1x Lottery Voucher': '', - // '1x Ammunition Pack': '', - // '1x Box of Medical Supplies': '', - // '1x Six Pack of Alcohol': '', - // '1x Lawyer Business Card': '', - // '1x Box of Grenades': '', '1x Random Property': '1个随机房产', '10% Bank Interest Bonus': '10% 银行利润增益', 'a 10% Bank Interest Bonus': '10% 银行利润增益', @@ -1272,13 +1261,14 @@ 'Free Banner Advertising': '免费横幅广告', 'a Free Banner Advertising': '免费横幅广告', 'Inactive': '未激活', + 'Ready for collection': '分红可领取', 'Benefit active': '分红已激活', 'provides': '将提供', 'Every': '在每', 'when holding at least': '后,仅当持有至少', 'shares currently valued at': '股时,目前总价:', 'days': '日', - 'Buy': '购买', + 'Buy': '再购买', 'more shares for': '股,目前总价', 'to unlock the': '用以解锁', 'increment': '增益', @@ -1318,6 +1308,12 @@ 'View': '查看', 'Sell': '售出', 'Merge': '合并', + 'Current Price:': '当前股价:', + 'change:': '变化:', + 'start:': '开始:', + 'end:': '结束:', + 'high:': '最高:', + 'low:': '最低:', }; const itemNameDict = { "Six Pack of Alcohol": '6瓶装酒箱', @@ -1331,11 +1327,97 @@ "Drug Pack": '药(dú)品包 (小DP)', "Clothing Cache": '服饰箱', "Box of Medical Supplies": '医疗补给包', + "Old Lady Mask": '老妇人面具', + "Chainsaw": '电锯', + "Plastic Sword": '塑料剑', + "Combat Gloves": '战斗手套', + "Combat Helmet": '战斗头盔', + "Combat Pants": '战斗裤', + "Diamond Bladed Knife": '钻石刀', + "Flamethrower": '喷火器', + "Axe": '斧头', + "Rusty Sword": '锈剑', + "Scarred Man Mask": '刀疤男面具', + "Cannabis": '大麻', + "Opium": '罂粟', + "Vicodin": '维柯丁', + "HEG": '高爆手雷', + "Grenade": '手雷', + "Flash Grenade": '闪光弹', + "Pepper Spray": '辣椒喷雾', + "Tear Gas": '催泪弹', + "Trout": '咸鱼', + "Throwing Knife": '飞刀', + "First Aid Kit": '急救包', + "Small First Aid Kit": '小型急救包', + "Empty Blood Bag": '空血包', + "Blood Bag : A-": 'A-血包', + "Blood Bag : A+": 'A+血包', + "Blood Bag : AB+": 'AB+血包', + "Blood Bag : AB-": 'AB-血包', + "Blood Bag : O+": 'O+血包', + "Blood Bag : O-": 'O-血包', + "Blood Bag : B-": 'B-血包', + "Blood Bag : B+": 'B+血包', + "Blood Bag : Irradiated": '辐射血包', + "Morphine": '吗啡', + "Neumune Tablet": '雄烯二醇抗辐射药品', + "Antidote": '抗生素', + }; + const itemDescDict = { + 'A lottery voucher which can be traded in for 100 lottery tickets for the weekly draw, courtesy of the Lucky Shot Casino.': + '', + }; + const itemEffectDict = { + // 彩票 + 'Effect: Provides 100 Lucky Shot Lotto tickets when used.':'', + // enhancer + 'Effect: Improves success rate for the Transporting Drugs crime.':'', + // 糖 + 'Effect: Increases happiness by 25 and booster cooldown by 30 minutes.':'', + 'Effect: Increases happiness by 50 and booster cooldown by 30 minutes.':'', + 'Effect: Increases happiness by 75 and booster cooldown by 30 minutes.':'', + // 能饮 + 'Effect: Increases energy by 10 and booster cooldown by 2 hours.':'', + }; + const itemTypeDict = { + 'is a Machine Gun Weapon.':'', + 'is a Temporary Weapon.':'是一种投掷武器。', + 'is a Clothing Item.':'是一种服装物品。', + 'is a Medical Item.':'是一种医疗物品。', + 'is a Drug Item.':'是一种药(dú)品。', + 'is an Energy Drink Item.':'是一种能量饮料。', + 'is an Alcohol Item.':'是一种酒。', + 'is a Candy Item.':'是一种糖。', + 'is a Booster Item.':'是一种增益道具。', + 'is an Enhancer Item.':'是一种增强道具。', + 'is a Supply Pack Item.':'是一种补给包。', + 'is an Electronic Item.':'是一种电子物品。', + 'is a Jewelry Item.':'是一种珠宝物品。', + 'is a Flower Item.':'是一种花。', + 'is a Plushie Item.':'是一种玩偶。', + 'is a class E Car Item.':'是一辆E级赛车。', + 'is a class D Car Item.':'是一辆D级赛车。', + 'is a class C Car Item.':'是一辆C级赛车。', + 'is a class B Car Item.':'是一辆B级赛车。', + 'is a class A Car Item.':'是一辆A级赛车。', + 'is a Virus Item.':'是一种电脑病毒。', + 'is an Other Item.':'是一个其他物品。', + 'is a Book Item.':'是一本书。', + 'is a Special Item.':'是一种特殊物品。', }; const tornSettingsDict = { - 'API Keys': '', - 'General settings': '', - 'Attack settings': '', + 'API Keys': 'API 密钥', + 'General settings': '通用设置', + 'Attack settings': '攻击设置', + 'Create New Key': '创建新密钥', + "New key's name": '新密钥名', + "Public Only": '无需权限', + "Minimal Access": '最小权限', + "Limited Access": '有限权限', + "Full Access": '完全权限', + 'Here you can share your account\'s information with': + '在这里,你可以通过向脚本、扩展和应用程序等软件提供API密钥,与它们分享你的账户信息。一旦你创建了一个具有相关权限的API密钥,你可以在任何时候通过删除该密钥来取消授权。', }; const missionDict = { '_taskHint': { @@ -1611,6 +1693,7 @@ }, standard_routine: { task: "使用冲击武器(Clubbing)或拳头或脚踢击败特定玩家", + hint: "可以考虑买一把金属双截棍(Metal Nunchakus)", }, stomach_upset: { task: "打伤特定玩家的胃", @@ -1654,6 +1737,9 @@ "with a brick.": '使用砖头 (brick)', "Put": '', }; + const pcDict = { + 'Virus Programming': '病毒编程', + }; // 默认开启通知翻译 if (!localStorage.getItem('wh_trans_event')) { @@ -2274,6 +2360,70 @@ return; } + /** + * 物品页面 + */ + if (window.location.href.contains(/item\.php/)) { + // let count = 0; + const $$ = $('.content-wrapper'); + const OB = new MutationObserver(() => { + OB.disconnect(); + titleTrans(); + contentTitleLinksTrans(); + trans(); + OB.observe($$.get(0), { + characterData: true, + attributes: true, + subtree: true, + childList: true + }); + }); + const trans = () => { + // console.log(count++) + // 物品名翻译 + const $item_name = $('ul.current-cont').length===0 + ?$('ul#all-items span.name') + :$('ul.current-cont span.name'); + $item_name.each((i, e) => { + if (!$(e).hasClass('wh-translated')) { + if (itemNameDict[$(e).text().trim()]) { + $(e).addClass('wh-translated') + .after(`${itemNameDict[$(e).text().trim()]}`); + } + } + }); + // 物品详情 + const $item_info = $('li.show-item-info div.item-cont span.info-msg'); + $item_info.contents().each((i, e) => { + // 物品描述 + if (e.nodeType !== 3) return; + if (itemDescDict[e.nodeValue.trim()]) e.nodeValue = itemDescDict[e.nodeValue.trim()]; + }); + $item_info.find('*').contents().each((i, e) => { + // the+物品名 物品种类 效果 + if (e.nodeType !== 3) return; + if (e.nodeValue.trim() === '') return; + if (i === 3) { + if (itemNameDict[e.nodeValue.trim().slice(4)]) { + e.nodeValue = itemNameDict[e.nodeValue.trim().slice(4)]; + } + return; + } + console.log(e.nodeValue.trim()) + if (itemTypeDict[e.nodeValue.trim()]) e.nodeValue = itemTypeDict[e.nodeValue.trim()]; + else if (itemEffectDict[e.nodeValue.trim()]) e.nodeValue = itemEffectDict[e.nodeValue.trim()]; + }); + }; + trans(); + OB.observe($$.get(0), { + characterData: true, + attributes: true, + subtree: true, + childList: true + }); + return; + } + /** * 任务 */ @@ -2304,7 +2454,6 @@ $('div.max-height-fix.info').each((i, e) => { if ($(e).find('.wh-translated').length !== 0) return; $(e).append(`
${getTaskHint(taskList[i])}
${getTaskHint('taskList[i]')}