CNCStats is a simple PHP library used for getting information about Command & Conquer players. It supports players for Red Alert 3, Command & Conquer 3, and Kane’s Wrath.
Download & Version History
[Mar-1-2010] : Version 1.0 – Initial Release – PHP source code
Background: www.cncboards.net
This code is extracted from the community site I developed… www.cncboards.net. The code base was written over a long period of time, starting with CNC3 in 2007. It originally was just a single page used to track my roommate’s and my player stats, but eventually expanded to allow anybody to use it with the release of Red Alert 3.
The site runs a background service on my server that continually updates my databases with info from various sources. This allows me to display play stats, match history, opponent information, and an extremely detailed ladder summary… complete with smurf account info (highly ranked players playing under a lower-ranked name).
Since then it has gone through a number of revisions and has seen various features come and go as I tried to make it a useful and important tool for the CNC community. At one point, it offered an automated month-long Clan Wars tournament and featured the ability to make custom leader boards and dynamic forum signatures.
It since has expanded to include all current Command & Conquer games, but now just sticks to stat tracking and match history.
cncstats
This PHP library is a simple collection of some of the more useful functions and classes I’ve developed for cncboards.net. All of the database functionality and other more advanced aspects have been removed so that what is left is a very straight forward, easy-to-use code library.
How To Use
Currently, the library only features a class called CNC_Player that allows you to fetch a player’s stats for either RA3, CNC3, or Kane’s Wrath. An example of usage:
include_once ('cncstats.php');
$player = new CNC_Player ();
$player->loadFromWeb ('storm717', 'ra3');
print_r ($player);
This creates a new CNC_Player object, loads that object with data about the RA3 player ’storm717′, and then outputs a nicely formatted string representation of the object (which will display all of the stats). This is an example of the output:
CNC_Player Object
(
[name] => storm717
[game] => ra3
[updated] => NOW()
[favoriteFaction] => 1
[winPercent] => 59.0
[avgMatchLength] => 362
[longestWinStreak] => 23
[totalMatches] => 252
[wins] => 149
[losses] => 97
[currentStreak] => -1
[totalDisconnects] => 5
[totalDesyncs] => 1
[totalMatchTime] => 91342
[avatar] => http://www.gamespyarcade.com/software/imglib/portraits/user/181/897/222/01000.jpg
[stripes] => http://www.commandandconquer.com/SiteAssets/common/images/RA3RankIcons/128x128/allied_28_blank_blank.png
[ranked1v1LadderRank] => 316
[ranked1v1LadderRecord] => 4-3
[ranked2v2LadderRank] => 0
[ranked2v2LadderRecord] => 0-0
[commanders] => Array
(
[0] => Array
(
[0] => DolphinRider
[1] => http://www.gamespyarcade.com/software/imglib/portraits/user/193/889/988/01000.jpg
)
[1] => Array
(
[0] => WailinOnHisLegs
[1] => http://www.gamespyarcade.com/software/imglib/portraits/user/193/489/165/01000.jpg
)
.... etc ...
)
[alliedRecord] => 138-84
[alliedTotalMatches] => 227
[sovietRecord] => 4-6
[sovietTotalMatches] => 10
[japanRecord] => 7-7
[japanTotalMatches] => 15
[unrankedRecord] => 16-9
[unrankedTotalMatches] => 25
[ranked1v1Record] => 131-88
[ranked1v1TotalMatches] => 225
[ranked2v2Record] => 2-0
[ranked2v2TotalMatches] => 2
[record] => 149-97
[unitKillRatio] => 0.88
)
Subscribe
One ResponseLeave one →