Torn Faction OC Item Handling

Uses Torn API to list missing OC item requirements for your faction and adds quick-send helpers on /item.php

作者
Canixe
日安装量
4
总安装量
8
评分
0 0 0
版本
1.0.6
创建于
2025-09-10
更新于
2025-09-11
大小
35.2 KB
许可证
暂无
适用于

Torn Faction OC Item Handling

Enhances Torn’s /item.php with a compact panel that lists missing OC item requirements for your faction (via the Torn API) and adds one-click actions to search, send, tag, confirm, and log item transfers.

Access needed: a Torn API key with Minimal Access only.


Features

  • Live Torn API integration – pulls your faction’s ongoing organized crimes and extracts unavailable item requirements.
  • One-click workflow – Search inventory → Send → Pick recipient → Add message → Confirm → Auto-log.
  • Smart messages – Separate messages for reusable tools vs consumables (fully configurable).
  • Accurate logging – Logs server time, item, player, and message. Copy all logs with a button.
  • Compact UI – Collapsible panel styled like Torn’s interface.

Installation and Use

  1. Install a userscript manager (e.g., Tampermonkey).
  2. In Torn, open the Items page (/item.php).
  3. Set your API key via the panel’s quick setter or the Tampermonkey menu.
    The API key requires Minimal Access.
  4. Click Refresh in the panel.
    Each row provides a single action button that cycles through: 🔎 search → 📤 send → 👤 recipient → 💬 message → ➡️ submit → ✔️ confirm.

Configuration (top of script)

// Messages
const MSG_REUSABLE   = "For upcoming OC, return when OC completed";
const MSG_CONSUMABLE = "For upcoming OC";
const MSG_DEFAULT    = "For upcoming OC";

// Item catalogs (ID → Name)
const REUSABLE_ITEMS   = new Map([[568,"Jemmy"], /* … */]);
const CONSUMABLE_ITEMS = new Map([[1361,"Dog Treats"], /* … */]);
// Add any missing IDs here if the panel warns about “Missing item mappings”.


How It Works

  1. Calls the Torn API: https://api.torn.com/v2/faction/crimes.
  2. For each crime → each slot with item_requirement.is_available === false → builds a display line:
    Player [UserID] (ItemName)
    • Unknown Item IDs are skipped and listed in a warning so you can add them.
  3. On confirm, the script reads the confirm form (player, item, message) to build the log entry and uses the current server time for the timestamp.
    Note: Log entries are generated by the script (not pulled from Torn’s activity log), so minor discrepancies are possible.

Troubleshooting

  • “Torn API error …” → Check your API key and that it has Minimal Access.
  • No rows shown → Your faction currently has no missing item requirements.
  • Missing item mappings → Add the listed IDs to REUSABLE_ITEMS or CONSUMABLE_ITEMS.

Privacy & Scope

  • Runs only on /item.php.
  • Stores your API key locally via the userscript manager.
  • Only contacts the Torn API (no third-party services).

Credits

  • Script by Canixe [3753120] · If it helps and you want to show appreciation, send a Xan or drop a thanks at my bazaar.
  • Not affiliated with Torn. Green-light from Script Moderator IceBlueFire [776].