Skip to content

TuRz4m/warroom-userscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TuRzAm WarRoom Connector

A Tampermonkey userscript that enhances the Torn.com gaming experience by connecting to the TuRzAm WarRoom service for real-time coordinated faction attacks.

🎯 Overview

This userscript integrates seamlessly with Torn.com to provide faction members with real-time attack coordination capabilities. It displays coordinated attack notifications directly within Torn's interface, allowing faction members to participate in synchronized attacks against targets.

✨ Key Features

Real-Time Attack Notifications

  • Live Attack Feed: Displays toast notifications for coordinated attacks on the factions page and optionally on attack pages
  • Attack Card Display: Shows detailed information for each coordinated attack including:
    • Target name and ID
    • Attack status (Active/Full)
    • Countdown timer with urgent warnings (under 1 minute)
    • Participant slots (filled/total)
    • List of participating members
    • Attack creator information

Attack Management

  • Join Attacks: One-click join functionality for available coordinated attacks
  • Create Coordinated Attacks: Create new coordinated attacks when viewing a target from your faction's war room list
  • Mark as Done: Mark attacks as complete when finished
  • Direct Attack Links: Quick access to attack pages for joined attacks
  • Auto-Hide Full Attacks: Automatically removes full attacks from the feed (configurable)

Attack Creation

When viewing a target's attack page (via https://www.torn.com/loader.php), if the target is in your faction's war room target list, you can create a coordinated attack with:

  • Custom number of participants (1-30)
  • Expiration time (1-15 minutes)
  • Option to wait until full before showing attack link
  • Creator automatically joins the attack

Smart Notifications

  • Visual Countdown Timer: Real-time countdown for each attack with urgent highlighting when time is running low
  • Sound Alerts: Optional audio notification when new attacks are created (configurable)
  • Status Badges: Visual indicators for attack status (Active/Full)
  • Automatic Expiration: Attacks are automatically removed when expired

Customizable Settings

Access the settings panel to configure:

  • API Key: Your WarRoom authentication key
  • Attack Feed Toggle: Enable/disable attack notifications on faction page
  • Attack Page Feed: Show/hide notifications on attack pages (loader.php)
  • Auto-Hide Full Attacks: Automatically hide attacks when they reach capacity
  • Sound Notifications: Enable/disable audio alerts for new attacks
  • Target Cache Management: Clear cached war room target data
  • Token Management: Clear authentication tokens when needed

User Interface

  • Non-Intrusive Toast Notifications: Stylish, glassmorphic toast cards that appear in the bottom-left corner
  • Floating Action Buttons: Quick access buttons for:
    • Attack feed toggle (enable/disable notifications)
    • Settings configuration
    • Create coordinated attack (on attack pages with valid targets)
  • Modern Design: Purple-themed UI with smooth animations and transitions
  • Responsive Elements: Click outside modals to close, keyboard shortcuts supported

Technical Features

  • SignalR Long Polling: Real-time connection to WarRoom service using SignalR
  • Automatic Reconnection: Handles connection drops with exponential backoff retry logic
  • JWT Authentication: Secure token-based authentication with automatic renewal
  • Target Caching: Caches war room targets for 1 hour to reduce API calls
  • XSS Protection: All user content is properly sanitized to prevent security vulnerabilities
  • CSP Bypass: Uses GM_xmlhttpRequest to work around Content Security Policy restrictions
  • Parallel Requests: Enhanced parallel request handling for better performance
  • Memory Management: Proper cleanup of timers and intervals to prevent memory leaks

πŸ“‹ Requirements

  • Tampermonkey browser extension (or compatible userscript manager)
  • Active account on Torn.com
  • TuRzAm WarRoom API key (obtainable from torn.zzcraft.net)
  • Faction membership with access to war rooms

πŸš€ Installation

  1. Install Tampermonkey for your browser
  2. Click on the Tampermonkey icon and select "Create a new script"
  3. Copy the contents of warroom-userscript.js and paste it into the editor
  4. Save the script (Ctrl+S or Cmd+S)
  5. The script will automatically activate on Torn.com

βš™οΈ Configuration

  1. Navigate to any Torn.com page where the script is active
  2. Click the settings button (gear icon) in the bottom-left corner
  3. Enter your WarRoom API key in the API Key field
  4. Configure your preferences:
    • Enable/disable attack feed on faction page
    • Enable/disable attack feed on attack pages
    • Toggle auto-hide for full attacks
    • Enable/disable sound notifications
  5. Click "Save" to apply your settings
  6. Refresh the page for changes to take full effect

πŸ“– Usage

Viewing Coordinated Attacks

  1. Navigate to the Factions page (https://www.torn.com/factions.php)
  2. Active coordinated attacks will appear as toast notifications in the bottom-left corner
  3. Each attack card shows:
    • Target information
    • Time remaining
    • Current participants
    • Available slots

Joining an Attack

  1. Click the "Join" button on any available attack notification
  2. You'll receive a confirmation message
  3. The attack card will update to show you as a participant
  4. Once joined, you'll see the "Attack" button to access the target

Creating a Coordinated Attack

  1. Navigate to attack a target via the attack interface (which uses loader.php)
  2. If the target is in your faction's war room list, a green plus button appears in the bottom-left
  3. Click the button to open the attack creation dialog
  4. Configure the attack parameters:
    • Number of participants needed
    • Expiration time in minutes
    • Whether to wait until full before showing the link
  5. Click "Create Attack" to broadcast to your faction

Marking Attacks as Complete

  1. Click the "Done" button on any attack you're participating in
  2. The attack will be removed from all participants' feeds

Toggling the Attack Feed

  1. Click the bell icon in the bottom-left corner to enable/disable notifications
  2. When enabled, the bell is purple
  3. When disabled, the bell is red with a line through it

πŸ”§ Technical Details

Permissions & Grants

  • GM_xmlhttpRequest / GM.xmlHttpRequest: For API communication bypassing CSP
  • GM_addStyle: Inject custom CSS for the user interface
  • GM_getValue / GM_setValue: Store settings and authentication tokens
  • Connection to api.torn.zzcraft.net: WarRoom service API

Matched Pages

The script automatically runs on:

  • https://www.torn.com/loader.php* - Attack pages for target detection and coordinated attack creation
  • https://www.torn.com/factions.php* - Faction pages where the attack feed is displayed

Architecture

  • SignalR Long Polling: Custom implementation for real-time communication
  • JWT Token Management: Automatic token storage, validation, and renewal
  • Event-Driven Updates: Listens for attack events (Added, Updated, Done, Removed)
  • Timer Management: Individual countdown timers for each active attack
  • Cache Layer: 1-hour TTL cache for war room targets

πŸ›‘οΈ Security

  • All user input is sanitized using HTML escaping to prevent XSS attacks
  • JWT tokens are stored securely using Tampermonkey's GM_getValue/GM_setValue
  • Token expiration is checked before each request with 5-minute buffer
  • Failed authentication attempts clear stored tokens
  • API communication uses HTTPS only

🎨 User Interface

The userscript features a modern, dark-themed interface with:

  • Glassmorphic Design: Semi-transparent cards with backdrop blur
  • Purple Accent Color: Consistent branding with #9b59b6 primary color
  • Smooth Animations: Slide-in/slide-out transitions for notifications
  • Responsive Layout: Adapts to different screen sizes
  • Accessibility: High contrast text and clear visual indicators

πŸ› Troubleshooting

No Attack Notifications Appearing

  1. Check that attack feed is enabled (bell icon should be purple)
  2. Verify your API key is configured in settings
  3. Ensure you're a member of a faction with active war rooms
  4. Check browser console for error messages

Authentication Errors

  1. Verify your API key is correct
  2. Clear the authentication token in settings
  3. Reload the page to re-authenticate

Attacks Not Updating

  1. Check your internet connection
  2. The script will attempt automatic reconnection
  3. If persistent, clear token and reload the page

Cache Issues

  1. Use the "Clear Cache" button in settings to reset target cache
  2. This forces a fresh fetch of war room targets

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Author

TuRzAm (GitHub: @TuRz4m)

πŸ”— Related Links

πŸ“ Version

Current Version: 1.0


This is a third-party userscript and is not officially affiliated with or endorsed by Torn.com

About

Torn WarRoom connector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •