- Add readme file
- Move vault transaction output to function - Add list of all transactions from vault - Start balance calculation functins
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# Torn Vault Tracker
|
||||
|
||||
Track vault balances for shared private island vaults in [Torn City](https://torn.com/).
|
||||
|
||||
## Description
|
||||
|
||||
Uses the [Torn API](https://www.torn.com/api.html) to pul the most recent vault transactions for you and your spouse. Note that in ordder to acess the "Log" endpoint, the keys used must be created with Full Access permissions.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Dependencies
|
||||
|
||||
* Any reasonable LAMP stack (developed on Ubuntu 20.04 with Apache and PHP 8.1.10)
|
||||
|
||||
### Installing
|
||||
|
||||
* Create folder in your server's web root, for example, 'tvt'
|
||||
* Upload/clone this repo into your folder
|
||||
* Edit `functions.php` to add API keys for you and your spouse
|
||||
* Open the tracker in any web browser
|
||||
|
||||
### Automating the API requests (TK)
|
||||
|
||||
## Help
|
||||
|
||||
Any advise for common problems or issues.
|
||||
```
|
||||
command to run if program contains helper info
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
Contributors names and contact info
|
||||
|
||||
Keith Solomon
|
||||
[KeithSolomon.net](https://keithsolomon.net/)
|
||||
|
||||
## Version History
|
||||
|
||||
* 0.1
|
||||
* Initial Release
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
Symos,26/09/2022,"Vault deposit",1
|
||||
Symos,26/09/2022,"Vault deposit",185354305
|
||||
Zarathos,27/09/2022,"Vault withdraw",-2000000
|
||||
Symos,27/09/2022,"Vault withdraw",-3000
|
||||
Symos,28/09/2022,"Vault withdraw",-1000000
|
||||
Zarathos,28/09/2022,"Vault withdraw",-2000000
|
||||
Symos,28/09/2022,"Vault withdraw",-300000
|
||||
Symos,30/09/2022,"Vault withdraw",-400000
|
||||
Symos,30/09/2022,"Vault withdraw",-150000
|
||||
Symos,30/09/2022,"Vault withdraw",-50000
|
||||
Symos,02/10/2022,"Vault withdraw",-2000000
|
||||
Zarathos,02/10/2022,"Vault withdraw",-2000000
|
||||
Symos,02/10/2022,"Vault deposit",1000000
|
||||
Symos,04/10/2022,"Vault withdraw",-300000
|
||||
Symos,05/10/2022,"Vault withdraw",-300000
|
||||
Zarathos,06/10/2022,"Vault withdraw",-2000000
|
||||
Symos,06/10/2022,"Vault withdraw",-2000000
|
||||
Symos,06/10/2022,"Vault withdraw",-10000000
|
||||
Symos,07/10/2022,"Vault withdraw",-350000
|
||||
Symos,07/10/2022,"Vault withdraw",-2000000
|
||||
Zarathos,13/10/2022,"Vault withdraw",-2000000
|
||||
Symos,14/10/2022,"Vault withdraw",-350000
|
||||
Symos,15/10/2022,"Vault withdraw",-350000
|
||||
Zarathos,16/10/2022,"Vault withdraw",-2000000
|
||||
Symos,16/10/2022,"Vault withdraw",-1200000
|
||||
Symos,18/10/2022,"Vault withdraw",-10000000
|
||||
Zarathos,19/10/2022,"Vault withdraw",-2000000
|
||||
Symos,21/10/2022,"Vault withdraw",-350000
|
||||
Symos,21/10/2022,"Vault withdraw",-1000000
|
||||
Symos,22/10/2022,"Vault withdraw",-350000
|
||||
Symos,23/10/2022,"Vault withdraw",-230000
|
||||
Zarathos,24/10/2022,"Vault withdraw",-80000000
|
||||
Zarathos,24/10/2022,"Vault deposit",12392725
|
||||
Symos,24/10/2022,"Vault withdraw",-1000000
|
||||
Zarathos,24/10/2022,"Vault deposit",2988600
|
||||
Zarathos,25/10/2022,"Vault deposit",89862
|
||||
Zarathos,25/10/2022,"Vault withdraw",-352500
|
||||
Symos,25/10/2022,"Vault withdraw",-600000
|
||||
Symos,25/10/2022,"Vault deposit",690914
|
||||
Symos,25/10/2022,"Vault withdraw",-1000000
|
||||
Zarathos,26/10/2022,"Vault withdraw",-3000000
|
||||
Zarathos,26/10/2022,"Vault withdraw",-2000000
|
||||
Symos,26/10/2022,"Vault withdraw",-1500000
|
||||
Symos,26/10/2022,"Vault withdraw",-5000000
|
||||
Symos,26/10/2022,"Vault withdraw",-750000
|
||||
Symos,28/10/2022,"Vault withdraw",-700000
|
||||
Symos,28/10/2022,"Vault deposit",96429637
|
||||
Symos,28/10/2022,"Vault withdraw",-800000
|
||||
Zarathos,28/10/2022,"Vault deposit",52642857
|
||||
Symos,29/10/2022,"Vault withdraw",-352500
|
||||
Symos,29/10/2022,"Vault withdraw",-750000
|
||||
Symos,30/10/2022,"Vault deposit",760975
|
||||
Symos,30/10/2022,"Vault withdraw",-352500
|
||||
Zarathos,31/10/2022,"Vault withdraw",-1000000
|
||||
Symos,31/10/2022,"Vault withdraw",-20000000
|
||||
Symos,31/10/2022,"Vault deposit",450000
|
||||
Symos,01/11/2022,"Vault withdraw",-400000
|
||||
Symos,01/11/2022,"Vault withdraw",-750000
|
||||
Zarathos,03/11/2022,"Vault withdraw",-100000000
|
||||
Symos,03/11/2022,"Vault deposit",99442460
|
||||
Symos,03/11/2022,"Vault withdraw",-500000
|
||||
Symos,03/11/2022,"Vault withdraw",-750000
|
||||
Zarathos,05/11/2022,"Vault withdraw",-2000000
|
||||
Symos,05/11/2022,"Vault withdraw",-500000
|
||||
Symos,07/11/2022,"Vault withdraw",-200000
|
||||
Zarathos,08/11/2022,"Vault withdraw",-2000000
|
||||
Symos,09/11/2022,"Vault withdraw",-350000
|
||||
Symos,09/11/2022,"Vault withdraw",-750000
|
||||
Symos,10/11/2022,"Vault withdraw",-50000
|
||||
Symos,11/11/2022,"Vault withdraw",-330000
|
||||
Symos,12/11/2022,"Vault withdraw",-1050000
|
||||
Symos,12/11/2022,"Vault withdraw",-75000
|
||||
Symos,12/11/2022,"Vault deposit",526550
|
||||
Symos,13/11/2022,"Vault withdraw",-350000
|
||||
Symos,14/11/2022,"Vault withdraw",-1000000
|
||||
Symos,14/11/2022,"Vault withdraw",-100000
|
||||
Symos,14/11/2022,"Vault withdraw",-10000000
|
||||
Symos,14/11/2022,"Vault deposit",5775234
|
||||
Symos,14/11/2022,"Vault withdraw",-16000000
|
||||
Symos,14/11/2022,"Vault withdraw",-1200000
|
||||
Symos,16/11/2022,"Vault withdraw",-350000
|
||||
Symos,16/11/2022,"Vault withdraw",-700000
|
||||
Symos,20/11/2022,"Vault withdraw",-1100000
|
||||
Symos,21/11/2022,"Vault withdraw",-200000
|
||||
Symos,22/11/2022,"Vault withdraw",-1050000
|
||||
Symos,25/11/2022,"Vault withdraw",-1000000
|
||||
Zarathos,29/11/2022,"Vault withdraw",-3000000
|
||||
Symos,29/11/2022,"Vault withdraw",-1000000
|
||||
Symos,02/12/2022,"Vault withdraw",-500000
|
||||
Symos,04/12/2022,"Vault withdraw",-10000000
|
||||
Symos,05/12/2022,"Vault withdraw",-500000
|
||||
Symos,06/12/2022,"Vault withdraw",-20000000
|
||||
Zarathos,07/12/2022,"Vault deposit",40000000
|
||||
Symos,09/12/2022,"Vault deposit",86455
|
||||
Symos,09/12/2022,"Vault withdraw",-1000000
|
||||
Zarathos,10/12/2022,"Vault deposit",2608832
|
||||
Zarathos,10/12/2022,"Vault withdraw",-1000000
|
||||
Symos,11/12/2022,"Vault withdraw",-200000
|
||||
Symos,11/12/2022,"Vault withdraw",-1000000
|
||||
Zarathos,12/12/2022,"Vault withdraw",-4000000
|
||||
Symos,14/12/2022,"Vault withdraw",-750000
|
||||
Symos,14/12/2022,"Vault withdraw",-15000000
|
||||
Zarathos,15/12/2022,"Vault deposit",3203752
|
||||
Zarathos,15/12/2022,"Vault withdraw",-5000000
|
||||
Symos,15/12/2022,"Vault withdraw",-750000
|
||||
Zarathos,17/12/2022,"Vault deposit",3915202
|
||||
Zarathos,17/12/2022,"Vault withdraw",-6000000
|
||||
Zarathos,17/12/2022,"Vault deposit",3000000
|
||||
Zarathos,17/12/2022,"Vault deposit",3000000
|
||||
Zarathos,17/12/2022,"Vault withdraw",-8000000
|
||||
Zarathos,17/12/2022,"Vault deposit",4000000
|
||||
|
@@ -120,4 +120,62 @@ function getLog($user, $csv) {
|
||||
return $usrVault;
|
||||
}
|
||||
|
||||
// vaultTxns(): Show all vault transactions
|
||||
function vaultTxns($csv) {
|
||||
$output = '';
|
||||
|
||||
$output .= '<table>';
|
||||
$output .= ' <thead>';
|
||||
$output .= ' <td>User</td>';
|
||||
$output .= ' <td>Timestamp</td>';
|
||||
$output .= ' <td>Operation</td>';
|
||||
$output .= ' <td>Amount</td>';
|
||||
$output .= ' </thead>';
|
||||
|
||||
$output .= ' <tbody>';
|
||||
|
||||
foreach ($csv as $entry) {
|
||||
if ($entry[2] == 'Vault withdraw') {
|
||||
$class = 'debit';
|
||||
} else {
|
||||
$class = 'credit';
|
||||
}
|
||||
|
||||
$output .= '<tr class="' . $class . '">';
|
||||
$output .= '<td>';
|
||||
$output .= $entry[0];
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= date("d/m/Y", $entry[1]);
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= $entry[2];
|
||||
$output .= '</td>';
|
||||
$output .= '<td>';
|
||||
$output .= formatMoney($entry[3]);
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
|
||||
$output .= ' </tbody>';
|
||||
|
||||
$output .= '</table>';
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
function splitVault(array $inputArray, string $fieldName, $fieldValue): array {
|
||||
$firstArray = [];
|
||||
$secondArray = [];
|
||||
|
||||
foreach ($inputArray as $item) {
|
||||
if (isset($item[$fieldName]) && $item[$fieldName] == $fieldValue) {
|
||||
$firstArray[] = $item;
|
||||
} else {
|
||||
$secondArray[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return [$firstArray, $secondArray];
|
||||
}
|
||||
?>
|
||||
@@ -21,43 +21,18 @@ include('functions.php');
|
||||
<div class="gridLeft">
|
||||
<h2>Transactions</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<td>User</td>
|
||||
<td>Timestamp</td>
|
||||
<td>Operation</td>
|
||||
<td>Amount</td>
|
||||
</thead>
|
||||
|
||||
<?php
|
||||
foreach ($csv as $entry) {
|
||||
if ($entry[2] == 'Vault withdraw') {
|
||||
$class = 'debit';
|
||||
} else {
|
||||
$class = 'credit';
|
||||
}
|
||||
|
||||
echo '<tr class="' . $class . '">';
|
||||
echo '<td>';
|
||||
echo $entry[0];
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo date("d/m/Y", $entry[1]);
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo $entry[2];
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo formatMoney($entry[3]);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php vaultTxns($csv); ?>
|
||||
</div>
|
||||
|
||||
<div class="gridRght">
|
||||
<h2>Balances</h2>
|
||||
|
||||
<?php
|
||||
$zarVault = [];
|
||||
$symVault = [];
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
Zarathos,1671111614,"Vault withdraw",-5000000
|
||||
Zarathos,1670871611,"Vault withdraw",-4000000
|
||||
Zarathos,1670698196,"Vault withdraw",-1000000
|
||||
Zarathos,1671108304,"Vault deposit",3203752
|
||||
Zarathos,1671306102,"Vault withdraw",-6000000
|
||||
Zarathos,1671306091,"Vault deposit",3915202
|
||||
Symos,1671136332,"Vault withdraw",-750000
|
||||
Zarathos,1671313291,"Vault withdraw",-8000000
|
||||
Zarathos,1671313285,"Vault deposit",3000000
|
||||
Zarathos,1671313280,"Vault deposit",3000000
|
||||
Zarathos,1671313336,"Vault deposit",4000000
|
||||
Symos,1671362029,"Vault withdraw",-50099
|
||||
Symos,1671449217,"Vault withdraw",-200000
|
||||
Symos,1671531176,"Vault withdraw",-1150000
|
||||
|
@@ -1,13 +1,114 @@
|
||||
Zarathos,1671111614,"Vault withdraw",-5000000
|
||||
Zarathos,1670871611,"Vault withdraw",-4000000
|
||||
Zarathos,1670698196,"Vault withdraw",-1000000
|
||||
Zarathos,1671108304,"Vault deposit",3203752
|
||||
Zarathos,1671306102,"Vault withdraw",-6000000
|
||||
Zarathos,1671306091,"Vault deposit",3915202
|
||||
Symos,1671136332,"Vault withdraw",-750000
|
||||
Zarathos,1671313291,"Vault withdraw",-8000000
|
||||
Zarathos,1671313285,"Vault deposit",3000000
|
||||
Zarathos,1671313280,"Vault deposit",3000000
|
||||
Zarathos,1671313336,"Vault deposit",4000000
|
||||
Symos,1671362029,"Vault withdraw",-50099
|
||||
Symos,1671449217,"Vault withdraw",-200000
|
||||
Symos,1671531176,"Vault deposit",1
|
||||
Symos,1671449217,"Vault deposit",185354305
|
||||
Zarathos,1671362029,"Vault withdraw",-2000000
|
||||
Symos,1671313336,"Vault withdraw",-3000
|
||||
Symos,1671313291,"Vault withdraw",-1000000
|
||||
Zarathos,1671313285,"Vault withdraw",-2000000
|
||||
Symos,1671313280,"Vault withdraw",-300000
|
||||
Symos,1671306102,"Vault withdraw",-400000
|
||||
Symos,1671306091,"Vault withdraw",-150000
|
||||
Symos,1671136332,"Vault withdraw",-50000
|
||||
Symos,1671111614,"Vault withdraw",-2000000
|
||||
Zarathos,1671108304,"Vault withdraw",-2000000
|
||||
Symos,1671040177,"Vault deposit",1000000
|
||||
Symos,1671016136,"Vault withdraw",-300000
|
||||
Symos,1670871611,"Vault withdraw",-300000
|
||||
Zarathos,1670766988,"Vault withdraw",-2000000
|
||||
Symos,1670765152,"Vault withdraw",-2000000
|
||||
Symos,1670698196,"Vault withdraw",-10000000
|
||||
Symos,1670688278,"Vault withdraw",-350000
|
||||
Symos,1670545830,"Vault withdraw",-2000000
|
||||
Zarathos,1670545791,"Vault withdraw",-2000000
|
||||
Symos,1670377491,"Vault withdraw",-350000
|
||||
Symos,1670349965,"Vault withdraw",-350000
|
||||
Zarathos,1670244703,"Vault withdraw",-2000000
|
||||
Symos,1670116570,"Vault withdraw",-1200000
|
||||
Symos,1670016835,"Vault withdraw",-10000000
|
||||
Zarathos,1669752535,"Vault withdraw",-2000000
|
||||
Symos,1669727309,"Vault withdraw",-350000
|
||||
Symos,1669373106,"Vault withdraw",-1000000
|
||||
Symos,1669148083,"Vault withdraw",-350000
|
||||
Symos,1669066986,"Vault withdraw",-230000
|
||||
Zarathos,1668945864,"Vault withdraw",-80000000
|
||||
Zarathos,1668623070,"Vault deposit",12392725
|
||||
Symos,1668620651,"Vault withdraw",-1000000
|
||||
Zarathos,1668454971,"Vault deposit",2988600
|
||||
Zarathos,1668448624,"Vault deposit",89862
|
||||
Zarathos,1668448165,"Vault withdraw",-352500
|
||||
Symos,1668448117,"Vault withdraw",-600000
|
||||
Symos,1668425952,"Vault deposit",690914
|
||||
Symos,1668425944,"Vault withdraw",-1000000
|
||||
Zarathos,1668342385,"Vault withdraw",-3000000
|
||||
Zarathos,1668278627,"Vault withdraw",-2000000
|
||||
Symos,1668257493,"Vault withdraw",-1500000
|
||||
Symos,1668257476,"Vault withdraw",-5000000
|
||||
Symos,1668165638,"Vault withdraw",-750000
|
||||
Symos,1668083990,"Vault withdraw",-700000
|
||||
Symos,1668020473,"Vault deposit",96429637
|
||||
Symos,1668019762,"Vault withdraw",-800000
|
||||
Zarathos,1667908445,"Vault deposit",52642857
|
||||
Symos,1667823512,"Vault withdraw",-352500
|
||||
Symos,1667671650,"Vault withdraw",-750000
|
||||
Symos,1667657116,"Vault deposit",760975
|
||||
Symos,1667508414,"Vault withdraw",-352500
|
||||
Zarathos,1667476826,"Vault withdraw",-1000000
|
||||
Symos,1667437181,"Vault withdraw",-20000000
|
||||
Symos,1667437109,"Vault deposit",450000
|
||||
Symos,1667345980,"Vault withdraw",-400000
|
||||
Symos,1667318742,"Vault withdraw",-750000
|
||||
Zarathos,1667221873,"Vault withdraw",-100000000
|
||||
Symos,1667221772,"Vault deposit",99442460
|
||||
Symos,1667214221,"Vault withdraw",-500000
|
||||
Symos,1667114176,"Vault withdraw",-750000
|
||||
Zarathos,1667089386,"Vault withdraw",-2000000
|
||||
Symos,1667070684,"Vault withdraw",-500000
|
||||
Symos,1667041715,"Vault withdraw",-200000
|
||||
Zarathos,1666989198,"Vault withdraw",-2000000
|
||||
Symos,1666982451,"Vault withdraw",-350000
|
||||
Symos,1666982327,"Vault withdraw",-750000
|
||||
Symos,1666954451,"Vault withdraw",-50000
|
||||
Symos,1666811983,"Vault withdraw",-330000
|
||||
Symos,1666807303,"Vault withdraw",-1050000
|
||||
Symos,1666791658,"Vault withdraw",-75000
|
||||
Symos,1666787938,"Vault deposit",526550
|
||||
Symos,1666787709,"Vault withdraw",-350000
|
||||
Symos,1666725938,"Vault withdraw",-1000000
|
||||
Symos,1666718869,"Vault withdraw",-100000
|
||||
Symos,1666718727,"Vault withdraw",-10000000
|
||||
Symos,1666697850,"Vault deposit",5775234
|
||||
Symos,1666697840,"Vault withdraw",-16000000
|
||||
Symos,1666648211,"Vault withdraw",-1200000
|
||||
Symos,1666643762,"Vault withdraw",-350000
|
||||
Symos,1666611072,"Vault withdraw",-700000
|
||||
Symos,1666572113,"Vault withdraw",-1100000
|
||||
Symos,1666526213,"Vault withdraw",-200000
|
||||
Symos,1666440143,"Vault withdraw",-1050000
|
||||
Symos,1666352812,"Vault withdraw",-1000000
|
||||
Zarathos,1666346167,"Vault withdraw",-3000000
|
||||
Symos,1666147254,"Vault withdraw",-1000000
|
||||
Symos,1666111587,"Vault withdraw",-500000
|
||||
Symos,1665913883,"Vault withdraw",-10000000
|
||||
Symos,1665889186,"Vault withdraw",-500000
|
||||
Symos,1665833653,"Vault withdraw",-20000000
|
||||
Zarathos,1665761001,"Vault deposit",40000000
|
||||
Symos,1665629507,"Vault deposit",86455
|
||||
Symos,1665171772,"Vault withdraw",-1000000
|
||||
Zarathos,1665128074,"Vault deposit",2608832
|
||||
Zarathos,1665092430,"Vault withdraw",-1000000
|
||||
Symos,1665062248,"Vault withdraw",-200000
|
||||
Symos,1665016968,"Vault withdraw",-1000000
|
||||
Zarathos,1664963225,"Vault withdraw",-4000000
|
||||
Symos,1664874290,"Vault withdraw",-750000
|
||||
Symos,1664733949,"Vault withdraw",-15000000
|
||||
Zarathos,1664718537,"Vault deposit",3203752
|
||||
Zarathos,1664702190,"Vault withdraw",-5000000
|
||||
Symos,1664578633,"Vault withdraw",-750000
|
||||
Zarathos,1664578629,"Vault deposit",3915202
|
||||
Zarathos,1664534054,"Vault withdraw",-6000000
|
||||
Zarathos,1664384959,"Vault deposit",3000000
|
||||
Zarathos,1664363903,"Vault deposit",3000000
|
||||
Zarathos,1664345448,"Vault withdraw",-8000000
|
||||
Zarathos,1664299424,"Vault deposit",4000000
|
||||
Symos,1664278862,"Vault withdraw",-50099
|
||||
Symos,1664227576,"Vault withdraw",-200000
|
||||
Symos,1664227460,"Vault withdraw",-1150000
|
||||
|
||||
|
Reference in New Issue
Block a user