您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Disables travel for individual countries if you do not have enough to purchase plushies/flowers, whichever costs more in case stock of out of your preferred item. Edit capacity or cash requirements if needed. 500k for Switzerland. Standard travel costs not included. Includes a $ button to toggle the script beside the Travel Agency title. Green $ means enabled.
当前为
// ==UserScript== // @name Torn - Cash Travel Restrictions // @namespace http://www.torn.com/ // @version 0.1 // @description Disables travel for individual countries if you do not have enough to purchase plushies/flowers, whichever costs more in case stock of out of your preferred item. Edit capacity or cash requirements if needed. 500k for Switzerland. Standard travel costs not included. Includes a $ button to toggle the script beside the Travel Agency title. Green $ means enabled. // @match https://www.torn.com/travelagency.php // @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com // @grant none // ==/UserScript== (function () { const travelCapacity = 29; // Change if your capacity is not 29 const travelCosts = { // Change numbers if you will need less or more for the item you want to purchase when travelling to that country mexico: 10000 * travelCapacity, // Jaguar Plushie cost cayman: 4000 * travelCapacity, // Banana Orchid cost canada: 600 * travelCapacity, // Crocus cost hawaii: 700 * travelCapacity, // Orchid cost uk: 5000 * travelCapacity, // Heather cost argentina: 500 * travelCapacity, // Ceibo Flower cost switzerland: 500000, // 2 rehabs cost japan: 500 * travelCapacity, // Cherry Blossom cost china: 5000 * travelCapacity, // Peony cost uae: 14000 * travelCapacity, // Camel Plushie cost 'south-africa': 2000 * travelCapacity // African Violet cost }; let mobileView; if (document.querySelector('.travel-info-table-list.ui-accordion-header.ui-helper-reset.ui-state-default.ui-corner-all.ui-accordion-icons')) mobileView = true; let userMoney; let cityFlags = {}; function getMoney() { // Get your money from the sidebar element const moneyElement = document.querySelector('[data-money]'); if (!moneyElement) { console.error('Unable to find element with data-money attribute.'); return; } userMoney = parseInt(moneyElement.getAttribute('data-money'), 10); } let isEnabled = JSON.parse(localStorage.getItem('cashTravelRestriction')) ?? true; const toggleButton = document.createElement('button'); toggleButton.innerText = '$'; toggleButton.style = isEnabled ? 'padding: 5px 10px; border-radius: 5px; background-color: #555555; color: lightgreen; border: none; cursor: pointer;' : 'padding: 5px 10px; border-radius: 5px; background-color: #555555; color: white; border: none; cursor: pointer;'; if (mobileView) { toggleButton.ontouchstart = toggleButton.onmousedown = () => { toggleButton.style.backgroundColor = '#444444'; }; toggleButton.ontouchend = toggleButton.onmouseup = toggleButton.onmouseleave = () => { toggleButton.style.backgroundColor = '#555555'; }; } else { toggleButton.onmouseover = () => { toggleButton.style.backgroundColor = '#444444'; }; toggleButton.onmouseout = () => { toggleButton.style.backgroundColor = '#555555'; }; } toggleButton.onclick = () => { isEnabled = !isEnabled; localStorage.setItem('cashTravelRestriction', isEnabled); toggleButton.innerText = '$'; if (isEnabled) { applyTravelRestrictions(); toggleButton.style.color = 'lightgreen'; } else if (!isEnabled) { enableFlights(); toggleButton.style.color = 'white'; } }; if ($('div.content-title > h4').length > 0) $('div.content-title > h4').append(toggleButton); function getCountryElements() { Object.keys(travelCosts).forEach((location) => { if (mobileView) { const flags = document.querySelectorAll(`.city-flag.${location}`); if (flags.length > 0) { cityFlags[location] = flags; } } if (!mobileView) { const flags = document.querySelectorAll(`.raceway.${location}`); if (flags.length > 0) { cityFlags[location] = flags; } } }); } function applyTravelRestrictions() { Object.entries(cityFlags).forEach(([location, flags]) => { const requiredCost = travelCosts[location]; if (userMoney < requiredCost) { flags.forEach((cityFlag) => { if (mobileView) { const travelOption = cityFlag.closest( '.travel-info-table-list.ui-accordion-header.ui-helper-reset.ui-state-default.ui-corner-all.ui-accordion-icons' ); if (travelOption) { travelOption.style.display = 'none'; } } if (!mobileView) { flags.forEach((cityFlag) => { cityFlag.style.pointerEvents = 'none'; cityFlag.style.opacity = '0.5'; }); } }); } }); } function enableFlights() { if (mobileView) { document.querySelectorAll('.travel-info-table-list.ui-accordion-header.ui-helper-reset.ui-state-default.ui-corner-all.ui-accordion-icons').forEach((travelOption) => { travelOption.setAttribute('style', ''); }); } if (!mobileView) { document.querySelectorAll('.raceway').forEach(button => { button.style.pointerEvents = 'auto'; button.style.opacity = '1'; }); } } function init() { getMoney(); getCountryElements(); if (isEnabled) applyTravelRestrictions(); } init(); const observer = new MutationObserver((mutationsList, observer) => { if (mobileView) { const travelButtons = document.querySelectorAll('.city-flag'); if (travelButtons.length > 0) { init(); setTimeout(() => { observer.disconnect(); }, 1000); } } if (!mobileView) { const travelButtons = document.querySelectorAll('.raceway'); if (travelButtons.length > 0) { init(); setTimeout(() => { observer.disconnect(); }, 1000); } } }); observer.observe(document.body, { childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址