Bad Company 2 stats:
';
}
//loop through the data and store stats in an array
$stats = array();
//create a weapon name array for calculating the weapon stars
$weapons = array(0=>aek,1=>xm8,2=>f2000,3=>aug,4=>an94,5=>m416,6=>m16,7=>'9a91',8=>scar,9=>xm8c,10=>aks74u,11=>uzi,12=>pp2,13=>ump,14=>pkm,15=>m249,16=>qju88,17=>m60,18=>xm81mg,19=>mg36,20=>mg3,21=>m24,22=>qbu88,23=>sv98,24=>svu,25=>gol,26=>vss,27=>m95,28=>m9,29=>mcs,30=>s12k,31=>mp443,32=>m1911,33=>m1a1,34=>mp412,35=>m93r,36=>spas12,37=>mk14ebr,38=>g3,39=>u12,40=>m1);
//create a vehicles name array for calculating the vehicle stars
$vehicles = array(0=>hmv,1=>vodn,2=>cobr,3=>quad,4=>m1a2,5=>t90,6=>m3a3,7=>bmd3,8=>bmda,9=>jets,10=>PBLB,11=>ah60,12=>MI28,13=>havoc,14=>uav,15=>XM312,16=>KORD,17=>KORN,18=>TOW2,19=>aav);
//create a gadgets name array for calculating the gadgets stars
$gadgets = array(0=>'40mmgl',1=>ammb,2=>'40mmsg',3=>rpg7,4=>rept,5=>atm,6=>m2cg,7=>m136,8=>medk,9=>defi,10=>mots,11=>c4,12=>mst,13=>knv,14=>hgr,15=>trad,16=>bay);
function compare_classes($x,$y)
{
if($x['score'] == $y['score'])
{
return 0;
}
elseif($x['score'] < $y['score'])
{
return 1;
}
else
{
return -1;
}
}
for($x=0;$x 0) {$queueCount = $queueCount + 1;}
//calculate attacker W/L ratio
$attRatio = round($attWin/$attLoss,2);
//calculate defender W/L ratio
$defRatio = round($defWin/$defLoss,2);
//calculate score per minute
$spm = round(($score/$raw_time)/60,0);
//calculate total number of pins
$totalPins = 0;
$z = 0;
for($z=0;$z<40;$z++)
{
$count = $data['players'][$x]['pins'][$z]['count'];
$totalPins = $count + $totalPins;
}
//calculate total number of insignias
$totalInsig = 0;
$z = 0;
for($z=0;$z<50;$z++)
{
$count = $data['players'][$x]['insiginias'][$z]['count'];
$totalInsig = $count + $totalInsig;
}
//calculate total number of gold, silver, & bronze stars
$totalPlat = 0;
$totalGold = 0;
$totalBron = 0;
$totalSilv = 0;
//from weapons
for($w=0;$w<41;$w++)
{
$weaponName = $weapons[$w];
$totalPlat = $data['players'][$x]['weapons'][$weaponName]['stars']['plat'] + $totalPlat;
$totalGold = $data['players'][$x]['weapons'][$weaponName]['stars']['gold'] + $totalGold;
$totalSilv = $data['players'][$x]['weapons'][$weaponName]['stars']['silv'] + $totalSilv;
$totalBron = $data['players'][$x]['weapons'][$weaponName]['stars']['bron'] + $totalBron;
}
//from vehicles
for($v=0;$v<20;$v++)
{
$vehicleName = $vehicles[$v];
$totalPlat = $data['players'][$x]['vehicles'][$vehicleName]['stars']['plat'] + $totalPlat;
$totalGold = $data['players'][$x]['vehicles'][$vehicleName]['stars']['gold'] + $totalGold;
$totalSilv = $data['players'][$x]['vehicles'][$vehicleName]['stars']['silv'] + $totalSilv;
$totalBron = $data['players'][$x]['vehicles'][$vehicleName]['stars']['bron'] + $totalBron;
}
//from gadgets
for($g=0;$g<17;$g++)
{
$gadgetName = $gadgets[$g];
$totalPlat = $data['players'][$x]['gadgets'][$gadgetName]['stars']['plat'] + $totalPlat;
$totalGold = $data['players'][$x]['gadgets'][$gadgetName]['stars']['gold'] + $totalGold;
$totalSilv = $data['players'][$x]['gadgets'][$gadgetName]['stars']['silv'] + $totalSilv;
$totalBron = $data['players'][$x]['gadgets'][$gadgetName]['stars']['bron'] + $totalBron;
}
//calculate which class they use
$assault = $data['players'][$x]['general']['sc_assault'];
$recon = $data['players'][$x]['general']['sc_recon'];
$demo = $data['players'][$x]['general']['sc_demo'];
$support = $data['players'][$x]['general']['sc_support'];
$the_classes = array();
$the_classes[0] = array('name'=>'assault','score'=>$assault);
$the_classes[1] = array('name'=>'recon','score'=>$recon);
$the_classes[2] = array('name'=>'demo','score'=>$demo);
$the_classes[3] = array('name'=>'support','score'=>$support);
//sort the classes array by score
usort($the_classes,'compare_classes');
$most_used = $the_classes[0]['name'];
$stats[$x] = array('name'=>$name,'rank'=>$rank,'score'=>$score,'kills'=>$kills,'deaths'=>$deaths,'dogt'=>$dogt,'level'=>$skillLevel,'ratio'=>$ratio,'spm'=>$spm,'time'=>$raw_time,'most_used'=>$most_used,'attRatio'=>$attRatio,'defRatio'=>$defRatio,'totalInsig'=>$totalInsig,'totalPins'=>$totalPins,'gold'=>$totalGold,'silv'=>$totalSilv,'bron'=>$totalBron,'plat'=>$totalPlat,'lastUpdate'=>$lastUpdate,'queue'=>$queue);
}
function sec2hms ($sec, $padHours = false)
{
$hms = "";
$hours = intval(intval($sec) / 3600);
$hms .= ($padHours)
? str_pad($hours, 2, "0", STR_PAD_LEFT). ':'
: $hours. 'h ';
return $hms;
}
function compare_stats($x,$y)
{
if($x['score'] == $y['score'])
{
return 0;
}
elseif($x['score'] < $y['score'])
{
return 1;
}
else
{
return -1;
}
}
function compare_spm_stats($x,$y)
{
if($x['spm'] == $y['spm'])
{
return 0;
}
elseif($x['spm'] < $y['spm'])
{
return 1;
}
else
{
return -1;
}
}
function compare_skill_stats($x,$y)
{
if($x['level'] == $y['level'])
{
return 0;
}
elseif($x['level'] < $y['level'])
{
return 1;
}
else
{
return -1;
}
}
function compare_kills_stats($x,$y)
{
if($x['kills'] == $y['kills'])
{
return 0;
}
elseif($x['kills'] < $y['kills'])
{
return 1;
}
else
{
return -1;
}
}
function compare_deaths_stats($x,$y)
{
if($x['deaths'] == $y['deaths'])
{
return 0;
}
elseif($x['deaths'] < $y['deaths'])
{
return 1;
}
else
{
return -1;
}
}
function compare_ratio_stats($x,$y)
{
if($x['ratio'] == $y['ratio'])
{
return 0;
}
elseif($x['ratio'] < $y['ratio'])
{
return 1;
}
else
{
return -1;
}
}
function compare_dogt_stats($x,$y)
{
if($x['dogt'] == $y['dogt'])
{
return 0;
}
elseif($x['dogt'] < $y['dogt'])
{
return 1;
}
else
{
return -1;
}
}
function compare_time_stats($x,$y)
{
if($x['time'] == $y['time'])
{
return 0;
}
elseif($x['time'] < $y['time'])
{
return 1;
}
else
{
return -1;
}
}
function compare_att_stats($x,$y)
{
if($x['attRatio'] == $y['attRatio'])
{
return 0;
}
elseif($x['attRatio'] < $y['attRatio'])
{
return 1;
}
else
{
return -1;
}
}
function compare_def_stats($x,$y)
{
if($x['defRatio'] == $y['defRatio'])
{
return 0;
}
elseif($x['defRatio'] < $y['defRatio'])
{
return 1;
}
else
{
return -1;
}
}
function compare_insig_stats($x,$y)
{
if($x['totalInsig'] == $y['totalInsig'])
{
return 0;
}
elseif($x['totalInsig'] < $y['totalInsig'])
{
return 1;
}
else
{
return -1;
}
}
function compare_pins_stats($x,$y)
{
if($x['totalPins'] == $y['totalPins'])
{
return 0;
}
elseif($x['totalPins'] < $y['totalPins'])
{
return 1;
}
else
{
return -1;
}
}
function compare_plat_stats($x,$y)
{
if($x['plat'] == $y['plat'])
{
return 0;
}
elseif($x['plat'] < $y['plat'])
{
return 1;
}
else
{
return -1;
}
}
function compare_gold_stats($x,$y)
{
if($x['gold'] == $y['gold'])
{
return 0;
}
elseif($x['gold'] < $y['gold'])
{
return 1;
}
else
{
return -1;
}
}
function compare_silv_stats($x,$y)
{
if($x['silv'] == $y['silv'])
{
return 0;
}
elseif($x['silv'] < $y['silv'])
{
return 1;
}
else
{
return -1;
}
}
function compare_bron_stats($x,$y)
{
if($x['bron'] == $y['bron'])
{
return 0;
}
elseif($x['bron'] < $y['bron'])
{
return 1;
}
else
{
return -1;
}
}
//sort the stats array by the sort variable passed in the url $_GET['sort']
if($_GET['sort'] == 'spm')
{
usort($stats,'compare_spm_stats');
}
elseif($_GET['sort'] == 'skill')
{
usort($stats,'compare_skill_stats');
}
elseif($_GET['sort'] == 'kills')
{
usort($stats,'compare_kills_stats');
}
elseif($_GET['sort'] == 'deaths')
{
usort($stats,'compare_deaths_stats');
}
elseif($_GET['sort'] == 'ratio')
{
usort($stats,'compare_ratio_stats');
}
elseif($_GET['sort'] == 'dogt')
{
usort($stats,'compare_dogt_stats');
}
elseif($_GET['sort'] == 'time')
{
usort($stats,'compare_time_stats');
}
elseif($_GET['sort'] == 'att')
{
usort($stats,'compare_att_stats');
}
elseif($_GET['sort'] == 'def')
{
usort($stats,'compare_def_stats');
}
elseif($_GET['sort'] == 'insig')
{
usort($stats,'compare_insig_stats');
}
elseif($_GET['sort'] == 'pins')
{
usort($stats,'compare_pins_stats');
}
elseif($_GET['sort'] == 'plat')
{
usort($stats,'compare_plat_stats');
}
elseif($_GET['sort'] == 'gold')
{
usort($stats,'compare_gold_stats');
}
elseif($_GET['sort'] == 'silv')
{
usort($stats,'compare_silv_stats');
}
elseif($_GET['sort'] == 'bron')
{
usort($stats,'compare_bron_stats');
}
else //sort by score as the default case
{
usort($stats,'compare_stats');
}
?>
|
if(count($data['players_nodata']>0)) { echo '
0'.$queueCount.' profiler i kø for oppdatering
'; //'There are '.count($data['players_nodata']).' members in the queue to have their stats processed
;'
}
?>
Stats powered by: bfbcs.com.


![<?=$stats[$out]['rank']?>](http://battlefieldbadcompany2.com/files/gui/img/stats/ranks/tiny/R0<?=$stats[$out]['rank']?>.png)