diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index c1a29d3..7c1cb20 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1,8 +1,8 @@ // ==UserScript== -// @lastmodified 202112161733 +// @lastmodified 202112181703 // @name Torn翻译 // @namespace WOOH -// @version 0.1.1216a +// @version 0.1.1218a // @description Torn UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -23,6 +23,11 @@ todo: true, cont: `baza npc商店 imarket及imarket搜索结果`, }, + { + ver: '0.1.1218a', + date: '20211218', + cont: `添加添加圣诞小镇附近掉落信息`, + }, { ver: '0.1.1216a', date: '20211216', @@ -5426,6 +5431,48 @@ margin: 0 0 3px; }); } }); + const chestTypeDict = {'1': '金', '2': '银', '3': '铜',}; + const lootTypeDict = {'chests': '宝箱', 'gifts': '礼物箱',} + window.setInterval(() => { + const $city_wrapper = $root.querySelector('#ct-wrap'); + if ($city_wrapper) { + const $wh_loot_container = $root.querySelector('#wh-loot-container'); + if (!$wh_loot_container) { + const insert_html = `
+
附近物品
+
+物品 +
+箱子 +
+
+
`; + $($city_wrapper).before(insert_html); + } + } + const items = $root.querySelectorAll('div.grid-layer div.items-layer div.ct-item'); + let item_list = []; + items.forEach(e => { + const item_props = {x: 0, y: 0, name: '', type: ''}; + item_props.x = parseInt(e.style.left.replaceAll('px', '')) / 30; + item_props.y = -parseInt(e.style.top.replaceAll('px', '')) / 30; + const srcSpl = e.firstElementChild.src.trim().split('/'); + item_props.name = srcSpl[6]; + item_props.type = srcSpl[8].slice(0, 1); + item_list[item_list.length] = item_props; + }); + const $wh_loot_container_items = $root.querySelector('#wh-loot-container-items'); + const $wh_loot_container_chests = $root.querySelector('#wh-loot-container-chests'); + $wh_loot_container_items.innerHTML = ``; + $wh_loot_container_chests.innerHTML = ``; + item_list.forEach(e => { + if (e.name === 'chests') { + $wh_loot_container_chests.innerHTML += `[${e.x},${e.y}] - ${chestTypeDict[e.type]}${lootTypeDict[e.name]}
` + } else { + $wh_loot_container_items.innerHTML += `[${e.x},${e.y}] - ${lootTypeDict[e.name] || '?钥匙'}
` + } + }); + }, 1200); return; } @@ -6355,7 +6402,11 @@ ${htmlCont}
* 任务助手 */ function getTaskHint(task_name) { - task_name = task_name.toLowerCase().replaceAll(' ', '_').replaceAll(',', ''); + task_name = task_name + .toLowerCase() + .replaceAll(' ', '_') + .replaceAll('-', '_') + .replaceAll(',', ''); if (!missionDict._taskHint[task_name]) return '暂无,请联系开发者'; const task = missionDict._taskHint[task_name].task || null; const hint = missionDict._taskHint[task_name].hint || null; diff --git a/torn-wh-show-loot-pos.user.js b/torn-wh-show-loot-pos.user.js new file mode 100644 index 0000000..4d2026c --- /dev/null +++ b/torn-wh-show-loot-pos.user.js @@ -0,0 +1,66 @@ +// ==UserScript== +// @name Torn圣诞小镇掉落物品坐标显示 +// @namespace WH +// @version 0.1 +// @description 在地图界面上方显示附近的宝箱、物品、钥匙坐标,兼容手机APP Torn PDA及Alook +// @author Woohoo[2687093] +// @match https://www.torn.com/* +// @grant none +// ==/UserScript== + + +(function () { + 'use strict'; + const ___window___ = window || window.unsafeWindow; + if (___window___.WHLOOTPOS) return; + ___window___.WHLOOTPOS = true; + + const $ = ___window___.jQuery; + + if (/christmas_town\.php/.test(window.location.href)) { + const $root = document.querySelector('#christmastownroot'); + const chestTypeDict = {'1': '金', '2': '银', '3': '铜',}; + const lootTypeDict = {'chests': '宝箱', 'gifts': '礼物箱',} + window.setInterval(() => { + const $city_wrapper = $root.querySelector('#ct-wrap'); + if ($city_wrapper) { + const $wh_loot_container = $root.querySelector('#wh-loot-container'); + if (!$wh_loot_container) { + const insert_html = `
+
附近物品
+
+物品 +
+箱子 +
+
+
`; + $($city_wrapper).before(insert_html); + } + } + const items = $root.querySelectorAll('div.grid-layer div.items-layer div.ct-item'); + let item_list = []; + items.forEach(e => { + const item_props = {x: 0, y: 0, name: '', type: ''}; + item_props.x = parseInt(e.style.left.replaceAll('px', '')) / 30; + item_props.y = -parseInt(e.style.top.replaceAll('px', '')) / 30; + const srcSpl = e.firstElementChild.src.trim().split('/'); + item_props.name = srcSpl[6]; + item_props.type = srcSpl[8].slice(0, 1); + item_list[item_list.length] = item_props; + }); + const $wh_loot_container_items = $root.querySelector('#wh-loot-container-items'); + const $wh_loot_container_chests = $root.querySelector('#wh-loot-container-chests'); + $wh_loot_container_items.innerHTML = ``; + $wh_loot_container_chests.innerHTML = ``; + item_list.forEach(e => { + if (e.name === 'chests') { + $wh_loot_container_chests.innerHTML += `[${e.x},${e.y}] - ${chestTypeDict[e.type]}${lootTypeDict[e.name]}
` + } else { + $wh_loot_container_items.innerHTML += `[${e.x},${e.y}] - ${lootTypeDict[e.name] || '?钥匙'}
` + } + }); + }, 1200); + } + +}()); diff --git a/torn-wh-xmas.user.js b/torn-wh-xmas.user.js index 8f57bb9..5a48c9d 100644 --- a/torn-wh-xmas.user.js +++ b/torn-wh-xmas.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Torn圣诞小镇解密攻略 // @namespace WH -// @version 0.1 +// @version 0.1.1 // @description 显示解密攻略 // @author Woohoo[2687093] // @match https://www.torn.com/* @@ -13,7 +13,7 @@ 'use strict'; const ___window___ = window || window.unsafeWindow; if (___window___.WHXMAS) return; - ___window___.WHXAMS = true; + ___window___.WHXMAS = true; const $ = ___window___.jQuery;