Torn Ranked War Calculator

Calculates ranked war targets, API fetching, draggable & minimizable UI (toggle in top-right).

作者
TheeeUnknown
今日安裝
0
安裝總數
16
評價
0 0 0
版本
1
建立日期
2025-05-22
更新日期
2025-05-22
尺寸
30.4 KB
授權條款
MIT
腳本執行於

Torn Ranked War Calculator

Calculate ranked war targets with ease! This script provides a draggable and minimizable UI to help you track war progress, target decay, and essential timings directly on Torn faction pages.

It leverages the Torn API to fetch active war data, or you can manually input information from a war announcement.


Features:

  • 🎯 Ranked War Calculations:
    • Calculates current target score, considering decay.
    • Shows score needed to meet the current target.
    • Estimates time until the target score decays to your desired score difference.
  • 🔗 Torn API Integration:
    • Optionally use your Torn API key (public faction data access) to automatically fetch:
      • Active war start time.
      • Initial target score.
      • Faction names and current scores.
    • Status messages for API fetching (success, errors, no active war).
  • 💡 User-Friendly Interface:
    • Minimizable Panel: Toggle the calculator's visibility with a button in the top-right corner (🎯 to show, 🔽 to hide).
    • Draggable: Click and drag the panel header to your preferred position on the screen.
    • Persistent State: Remembers your API key and the panel's last position.
    • Clear Display: Shows faction scores, war status (waiting, active, ended), war start/end times, decay information, and time to desired target.
  • 📋 Manual Input & Auto-fill:
    • Paste war announcements to parse start time and faction names.
    • Manually input initial target score and current faction scores.
    • Target score difference is automatically calculated based on current faction scores.
  • 🔄 Real-time Updates:
    • Automatically refreshes calculations every second once processed.
  • 💾 Data Persistence:
    • Saves your API key, war information (if not using API), and input scores locally so you can pick up where you left off.
  • 🎨 Inspired Design: Modern look and feel with clear visual cues.

API Key Information:

This script can use your Torn API key to fetch public faction data for active ranked wars.

  • Required Scope: You only need an API key with public faction data access.
  • Privacy: Your API key is stored locally in your browser using Greasemonkey/Tampermonkey's GM_setValue function.
  • Security: Your API key is NOT sent to the script author or any third party. It is only used to communicate directly with the Torn API (api.torn.com).

How to Use:

  1. Install the UserScript using a manager like Tampermonkey or Violentmonkey.
  2. Navigate to a Torn faction page (e.g., https://www.torn.com/factions.php*).
  3. A toggle button (🎯) will appear in the top-right corner of the page. Click it to open the calculator panel.
  4. API Method (Recommended):
    • Enter your Torn API Key (with public faction access) into the "Torn API Key" field.
    • Click "Fetch Active War Data (API)".
    • If an active war is found, details will be auto-filled.
  5. Manual Method:
    • Paste the war announcement text into the "War Announcement" field.
    • Enter the "Initial Target Score".
    • Manually input "Faction A Score" and "Faction B Score". Faction names will be parsed from the announcement if available.
  6. Click "Process & Calculate".
  7. The display will update with war information, target scores, and decay timers.
  8. The panel can be dragged by its header and minimized/restored using the top-right toggle button.
  9. Click "Clear & Reset" to clear all inputs and saved data (except the API key).

Notes:

  • The script is designed to work on document-idle, meaning it loads after the main page content.
  • Ensure your API key has the correct (minimal) permissions.
  • If you manually update scores, the display will reflect changes instantly if a calculation is already running.
  • The "Target Score Diff." field is auto-calculated based on the current scores of Faction A and Faction B and is used to estimate when the war target will decay to that specific difference.

Author: TR0LL