ET:QW Stats Program by Jay "Awol" Clark
Version 1.0
© 2007 James Clark
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
* About the program
This program takes the log files from Enemy Territory and parses the data into a MySQL database. Using that data it feeds a webpage which will desplay the stats for both the server and the players. It is great for community ran servers who only want to compare regular players to each other. It can display a lot of data but unfortunitly it can not go into detail as Splash Damage Rank Server Stats go into.
* Contact information
Email : awol@puregamer.com
Website : www.puregamer.com
MSN : awol1010@hotmail.com
* Requirements
Perl (Tested on ActiveState Perl v5.8.8) See no reason why it won't work on other versions of Perl
DBI Package for Perl, with the MySQL DBD driver
Time::Local (Should be part of the perl install)
File::Copy (Should be part of the perl install)
MySQL Server (Tested on Running on MySQL 4) See no reason why it won't work on other versions of MySQL
PHP (Tested on PHP 4.4.0) See no reason why it won't work on other versions of PHP
INSTALLING THE PROGRAM
* Setting up the server for log files
You need to either add these line to your server.cfg or change it so it reflects these settings. I also suggest
you change your fs_UserPath and fs_SavePath to the same place so it will dump both sets of log files in the same place.
logFile "1" // 1 = buffer log, 2 = flush after each print, default = "0"
logFileName "ETQW.log" // if empty, console.log will be used.
logTimeStamps "1" // add time stamps to console log, default = "0"
g_logObjectives "1" // log objective completion info, default = "1"
* Setting up the Database
- Edit the config.pl file and fill in your database and log file information.
#ET:QW log file folder (include the trailing "/")
$ETQWLogFolder = "./logs/";
#Log file prefix. This is the part of the filename that doesn't change. (This is needed)
$ETQWLogPrefix = "ETQW";
#Objective log folder (include trailing "/")
$ObjFolder = "./logs/";
#Objective log file name
$ObjFile = "objective.log";
#The folder all processed log files will be moved to (Include trailing slash "/").
$ArchiveFolder = "./Archive/";
#Database Information
$dbhost = "localhost"; #Server or Hostname of your MySQL Server
$database = "ETQWStats"; #Database to use
$dbuser = "Username"; #Username for the MySQL Server
$dbpass = "Password"; #Password for the MySQL Server
$TablePrefix = "";
- Create the database. (If you can not create new databases you may use the $TablePrefix variable so you can use an existing database.)
- Create your database (Do this by hand in MySQL)
- Run the CreateDatabase.pl file on the command line. (DOS Prompt or shell) This will create a database with the name you specified in the config file.
- Run install.pl on the command line. (DOS prompt or shell) This will create the table structure in the database.
* Setting up the PHP (Web Pages)
- Copy all the php files, the css file, and the 2 folders to your website.
- Edit config.php and fill out the database information.
- (OPTIONAL) Edit the ETQWStats.css file to change colors of the webpages.
* Running the Stats
When running the stats its important to know that the program isn't smart. It will read the same log file and reprocess any stats over again if its not archived or if it couldn't be deleted. I suggest creating a batch file or shell script to copy the log files from your ETQW directory to ETQWStats directory. To do this correctly you will need to shutdown your ETQW server. I personally run my server's stats every night and its fully automated. I shutdown the server, copy the 2 log files over to my stats folder, Start the server, run all 2 stat programs (listed below). The program will archive the files for you in case you need to redo stats at sometime in the future.
- Run the ETQWStats.pl file on the command line (DOS Prompt or Shell) It will process all the ETQW log files in the log folder you specified in the config file. After it finished each file it will move the file to your archive folder.
- Run the ETQWStatsObj.pl file on the command line. It will process the objective.log file and them move it to your archive folder.(This can only be ran after all the ETQW log files are ran otherwise it might not record stats for players)
- Run the ETQWStatsRank.pl file. It will read the entire database giving each player a rank based on time, kills, and xp. (You can run this file at anytime)
* Future plans
- Create a Server Only mod for ET:QW to dump more stats into the log and to make it easier to grab information from the log files. This includes which vehicle a weapon was used from. Who completed the objective. Health packs given, etc.
- I might even think about tying Real Time stats into the server only mod so the game itself would just write to the database and no need to run external programs.
Change Log
Version 1.0
- ETQWStats is now out of beta (This doesn't mean all the bugs are gone just means I believe it to be at an acceptable state)
- Fix the Play Time bug that popped up in the last version. Actually this bug existed for a while its just I never saw it until I ran this weekends log file.
- Fix the rare error where SQL would complain about certain characters in a players name.
- Added a script that will create the database needed for the program.
- Added a running time to the ETQWStatsObj.pl file. I'm hoping with this in place I can figure out why this takes so long to run and using a lot of the MySQL Server's CPU.
- Fixed a config.php file which resulted in PHP throwing an error running any of the PHP files.
Version 0.98
- Added more vehicle weapon images
- Create a new script to process the objective.log file, before this was part of ETQWStats.pl. This will allow the multiple log file processing to happen.
- Edited the search.php to look a little nicer and to change the way it searches the database for players
- Added Rank text to the program. I used the ET:QW default rank list but if you want your own ranks you can edit them in config.php
- Fixed a few errors in the css files.
- Fixed a few non standard issues in my php coding. (Didn't cause any issues that I know of but who knows in the future)
- Fixed all the php files so they would still work even if global registers where turned off.
- Redid how it computed kill stats I was getting error in the parsing due to weird clan tags. This should solve the issue but might be missing certain weapons
- Edited ETQWStats.pl to allow processing of a folder for log files.
Version 0.96
- Changed the Ranking code to allow server admins create their own values for rank. Check out the file for more information, The documentation will me made clearer on later versions.
- Fixed an issue with the Table Prefix value where it would break current installations of the program. If you started on v0.95 you will need to start all over again or put a "_" (Underscrore) after your table prefix for it to work correctly.
- Fixed more division by zero errors.
Version 0.95
- Created a database install script that will create the tables
- Added a Table Prefix for those people who may not be able to create new databases
- Added a config.pl file to hold all setting for the perl files
- Fixed the divide by zero errors in the php files
- Fixed some sql errors called in the php files
- Renamed the images files for those on case-sensative file systems (Let me know if I missed any)
- Fix the hard coded database name in the php files. Now using the correct variable name.
- Fixed the php files so the wouldn't need register globals turned on.
- Added Rank titles for the player.php file will so a name instead of a number.
- Create placeholder images for those weapons that didn't have any images.
- Added HTTP headers to the perl files for those who run this in the web browser
- Added a Title variable to the config.php file.
Version 0.9