# Torn Vault Tracker icon Torn Vault Tracker ![PHP Version](https://img.shields.io/badge/PHP-8.3%2B-blue.svg) ![Database](https://img.shields.io/badge/Database-SQLite3-blue.svg) [Deployed with FTP Deploy Action](https://github.com/SamKirkland/FTP-Deploy-Action) A web-based tracking system for monitoring shared vault transactions in the [Torn City MMORPG](https://torn.com/). ## Description This tool automatically tracks deposits and withdrawals from your Torn City private island vault using the official Torn API. It provides real-time balance tracking, available vault space calculations, and a transaction history display for multiple users. Key Features: - 🕒 Automatic transaction synchronization via Torn API - 💰 Real-time balance calculations (individual & combined) - 📊 Color-coded transaction history (green deposits/red withdrawals) - 🛡️ Secure API key management - 📈 Vault space monitoring with individual user shares - 💾 SQLite database for persistent storage ## Features ### Core Functionality - Automated API polling for vault transaction logs - Duplicate transaction prevention - Responsive HTML/CSS interface - Error handling for API failures and database issues - Automatic database schema creation and history population ### Financial Tracking - Individual user balances - Total vault balance calculation - Remaining vault space tracking (500M per user / 1B total) - Historical transaction records with timestamps ## Installation ### Requirements - Web server with PHP 8.1+ - SQLite3 extension enabled - Write permissions for web server user > [!NOTE] > If you need hosting, I recommend [InfinityFree](https://www.infinityfree.com/). They have a robust free hosting package that has everything you need to run this project (I run my personal copy of this project on their service). ### Setup Steps 1. Upload the project files to your web hosting. You can do this with an FTP client or by using `git` directly on the server (if your host supports it). - To use `git`: Clone repository to web directory (the command as written will put all files in a `tvt` directory): ```bash git clone https://github.com/yourusername/tvt.git ``` 2. Open `config.php` and configure the API keys and other settings. 3. Access the project in your web browser to initialize the database and start tracking transactions. The first run will create the database and import the vault transactions for both users. Depending on the number of transactions, this may take some time (my dev install took about 25 seconds to pull in ~2,100 transactions). The browser will refresh when the process is complete. ### Configuration > [!IMPORTANT] > API keys **must** have "Full Access" permissions to access `log` endpoints. Edit `config.php` to set up API access: - `username1` and `username2` should be changed to your usernames. ```php const USER_KEYS = [ 'username1' => 'your_api_key_here', 'username2' => 'partner_api_key_here' ]; ``` - If you want to change the number of rows per page in the transactions table (default is 15), change the `ROWS_PER_PAGE` constant ## Usage Access the tracker through your web browser after setup and configuration: - Transactions will automatically sync on page load going forward - Balance calculations update in real-time - Recent transactions display in chronological order ### Contribution We welcome contributions! Please follow these guidelines: - Fork the repository - Create feature branch (git checkout -b feature/improvement) - Follow existing PHP coding standards - Test changes thoroughly - Submit a pull request ### Credits Primary Author: [Keith Solomon](https://KeithSolomon.net) (_[ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) in Torn City_) ### Acknowledgements - [Torn City API documentation](https://www.torn.com/api.html) - [Torn City API Development Forum](https://www.torn.com/forums.php?p=forums&f=63&b=0&a=0) - [Roboto font by Christian Robertson](https://fonts.google.com/specimen/Roboto) > [!IMPORTANT] > **Disclaimer:** This project is not affiliated with or endorsed by Torn City