您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Show an alert if you're about to fly without one or more of special Halloween weapons/armor.
当前为
// ==UserScript== // @name Halloweek Equipment Alert // @namespace http://tampermonkey.net/ // @version 2024-10-30 // @description Show an alert if you're about to fly without one or more of special Halloween weapons/armor. // @author Vrocks [2577848] // @match https://www.torn.com/travelagency.php // @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com // @license MIT // @grant none // ==/UserScript== // START - CONFIGURATION const API_KEY = "REPLACE_THIS_WITH_YOUR_API_KEY"; const CHECK_MELEE = true; const CHECK_ARMOR = true; const CHECK_TEMPORARY = true; // END - CONFIGURATION const ID_CRYSTALINE_FALCATA = 1173; const ID_STARSHIELD_BREASTPLATE = 1174; const ID_STYGIAN_DARKNESS = 1175; const getPlayerEquipment = async () => { const url = "https://api.torn.com/user/?selections=equipment&key=" + API_KEY; const response = await fetch(url); try { if (!response.ok) { return null; } const responseJson = await response.json(); if (!"equipment" in responseJson) { return null; } return responseJson.equipment } catch (error) { console.error(error); return null; } }; const checkPlayerEquipment = async () => { const equipmentArray = await getPlayerEquipment(); if (!equipmentArray) { alert(`Halloweek Equipment Alert\n\nSomething went wrong while checking your equipment.\n- The API key you provided may not have access to your inventory\n-Torn API is acting up\nPlease make sure to check your equipment manually.`) return } window.equipmentArray =equipmentArray const hasMelee = equipmentArray.some( (item) => item.ID === ID_CRYSTALINE_FALCATA ); const hasArmor = equipmentArray.some( (item) => item.ID === ID_STARSHIELD_BREASTPLATE ); const hasTemporary = equipmentArray.some( (item) => item.ID === ID_STYGIAN_DARKNESS ); if (CHECK_MELEE && !hasMelee) { alert("Halloweek Equipment Alert\n\nYou have not equipped the melee weapon - Crystalline Falcata."); } if (CHECK_ARMOR && !hasArmor) { alert("Halloweek Equipment Alert\n\nYou have not equipped the armor - Starshield Breastplate."); } if (CHECK_TEMPORARY && !hasTemporary) { alert("Halloweek Equipment Alert\n\nYou have not equipped the temporary weapon - Stygian Darkness."); } }; (function() { 'use strict'; checkPlayerEquipment() })();