<?php
/*======================================================================*\
|| #################################################################### ||
|| # eGamers of Tomorrow Battlefield 3 Leaderboard                    # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernt werden                      # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------Teil des Bf3 Leaderboards von EoT-----------------# ||
|| #                      http://eot-clan.net                         # ||
|| #################################################################### ||
\*======================================================================*/
         
   if(!defined('DIRECTACCESS')){
echo 'You cannot access this file directly!';
die;
}
        $aAssault = array("arAEK","arAK74","arAN94","arF2","arG3","arKH","arM16","arM416","wahUGL","wahUSG","arFAMAS","arL85A2","arAUG","arSCARL");
	  		$aRecon = array("srM40","srM98","srMK11","srSKS","srSV98","srSVD","srQBU88","srL96","srM39","srHK417","srJNG90");
	  		$aSupport = array("mgM240","mgM249","mgM27","mgM60","mgPech","mgRPK","mgT88","mgQBB95","mgMG36","mgL86A1","mgLSAT");
	  		$aEngineer = array("caA91","caAKS","caG36","arF2","caM4","caSCAR","caSG553","wLAAFIM","wLAAIGL","wLATJAV","wLATRPG","wLATSMAW","caHK53","caQBZ95B","caACR","caMTAR21");
	  		
	 
	  		
 $aUnlocks = array(
             "arAK74" => "350",
             "arM416" => "350",  
             "arAEK" => "350",
             "arM16" => "350",
             "arAN94" => "350",
             "arF2" => "350",
             "arG3" => "350",
             "arKH" => "350",
             "srM40" => "270",
             "srM98" => "270",
             "srMK11" => "270",
             "srSKS" => "270",
             "srSV98" => "270",
             "srSVD"  => "270",
             "srM39" => "270",
             "mgM240" => "235",
             "mgM249" => "235",
             "mgM27" => "270",
             "mgM60" => "235",
             "mgPech" => "235",
             "mgRPK" => "270",
             "mgT88"  => "235",
             "caA91" => "300",
             "caAKS" => "300",
             "caG36" => "350",
             "caM4" => "350",
             "caSCAR" => "350",
             "caSG553" => "350",
             "sg870" => "350",
             "sgDAO" => "300",
             "sgM1014" => "350",
             "sgSaiga" => "350",
             "sgUSAS" => "350",
             "smMP7" => "150",
             "smP90" => "150",
             "smPDR" => "150",
             "smPP2000" => "150",
             "smUMP" => "150",
             "smVAL" => "175",
             "arFAMAS" => "350",
             "arL85A2" => "350",
             "caHK53" => "300",
             "caQBZ95B" => "270",
             "mgQBB95" => "235",
             "mgMG36" => "235",
             "srQBU88" => "270",
             "srL96" => "270",
             "smPP19" => "150",
             "sgJackH" => "350",
             "wahUGL" => "20",
             "arAUG" => "350",
             "arSCARL" => "350",
             "mgL86A1" => "350",
             "mgLSAT" => "200",
             "caACR" => "350",
             "caMTAR21" => "300",
             "srHK417" => "270",
             "srJNG90" => "270",
             "sgSPAS12" => "350",
             "smM5K" => "175"
             );
 
 

?>
	<table class="default" id="weapons" cellspacing="0" cellpadding="5">	           
		<thead>
     <td class="head" colspan="10" cellspacing="0"><?php echo LANG_WEAPONS_TITLE; ?></td>
    <tr>
      <th  width="140px"><?php echo LANG_WEAPONS_WEAPON; ?></th> 
       <th  width="80px"><?php echo LANG_WEAPONS_STARS; ?></th>
        <th  width="80px"><?php echo LANG_WEAPONS_TIME; ?></th>
         <th  width="87px"><?php echo LANG_WEAPONS_KILLS; ?></th>
         <th  width="87px"><?php echo LANG_WEAPONS_HEADSHOTS; ?></th>
         <th  width="87px">HS &percnt;</th>
        <th  width="87px"><?php echo LANG_WEAPONS_SHOTS; ?></th> 
       <th  width="85px"><?php echo LANG_WEAPONS_HITS; ?></th>
      <th  width="60px"><?php echo LANG_WEAPONS_ACCURACY; ?></th>
      <th  width="40px">Unl.</th>
      </thead> 
        <tbody> 
	  	<?php 
	  	
	  	foreach ($aWeapons as $key => $weapon){
	  		if ($data[$key.'_shots'] > 0){
	  		 $accuracy = $data[$key.'_hits']*100/$data[$key.'_shots'];
	  		
	  		 if (in_array($key,$aAssault)){
	  		 	$class = '<div style="margin-left:3px;margin-top:-3px;position:absolute;font-size:11px"><img src="img/weapons/class/assault.png" title="Assault"/></div>';
	  		}else if (in_array($key,$aRecon)){
	  		 	$class = '<div style="margin-left:3px;margin-top:-3px;position:absolute;font-size:11px"><img src="img/weapons/class/recon.png" title="Recon"/></div>';
	  		}else if (in_array($key,$aSupport)){
	  		 	$class = '<div style="margin-left:3px;margin-top:-3px;position:absolute;font-size:11px"><img src="img/weapons/class/support.png" title="Support"/></div>';
	  		}else if (in_array($key,$aEngineer)){
	  		 	$class = '<div style="margin-left:3px;margin-top:-3px;position:absolute;font-size:11px"><img src="img/weapons/class/engineer.png" title="Engineer"/></div>';
	  		
	  		}else{
	  			$class = '<div style="margin-left:3px;margin-top:-3px;position:absolute;font-size:11px"><img src="img/weapons/class/all.png" title="All other"/></div>';
	  		}
	  		  				  		
	  	$weaponsName = 'LANG_WEAPONS_'.$key;
	  	$weaponsTEXT = 'LANG_WEAPONS_TEXT_'.$key;
	  	
	  	
	  		
	  	
	  	if (array_key_exists($key,$aUnlocks)){		
	  		  	  if ($data[$key.'_kills'] >= $aUnlocks[$key]){
	  		  		  $unlocks = "<a id='bf3statsUnlocks' href=module/weaponsUnlocks.php?wUnlocks=".$key."&name=".rawurlencode($data['soldiername']).">100%</a>";
	  		  	  }else{
	  		  	  	$wUnlock = $key;
	  	           include('unlocksArray.php');
	  	             $i = 0;
	  	             foreach ($unlocks as $aItem => $aUnlock){
	  		             if ($data[$key.'_kills']  < $aUnlock){		
	  			           $unlocks = "<a id='bf3statsUnlocks' class='tooltip' href=module/weaponsUnlocks.php?wUnlocks=".$key."&name=".rawurlencode($data['soldiername']).">".number_format($data[$key.'_kills']*100/$aUnlocks[$key], 2, ',', ' ')."%
	  			           <span style='margin-top:-35px;margin-left:-215px;width:200px;z-index:1000;'>".LANG_WEAPONS_UNLOCKS_NEXT."<b>".constant('LANG_WEAPONS_UNLOCKS_'.$aItem)."</b><br /><img src='img/weapons/weaponunlocks/".$aItem.".png' /><br />".LANG_WEAPONS_UNLOCKS_NEED."<font class='DIVtext'>".($aUnlock-$data[$key."_kills"])."</font>".LANG_WEAPONS_UNLOCKS_KILLS."<b>".constant($weaponsName)."</b></span></a>
	  			           </a>";
	  			            if (++$i == 1) break;
	  		             }     
	  	             }
	  		  		 	 }
	  		  }else{
	  		  	$unlocks = "--";
	  		  }
	  		  	
	  	
	  	if ($data[$key.'_kills'] < 100){
	  		$Star = '<td class="result" width="90px">----</td>';
	  	}else{
	  	  $Star = '<td class="result" width="90px">
	  	            <div>
	  	              <img src="img/stars/stars_back.png" />
	  	               <div style="margin-left:'.marginWeaponStars($data[$key.'_count']).'px;margin-top:-15px;position:absolute;font-size:11px">'.$data[$key.'_count'].'</div>
	  	              </div>
	  	            </td>
	  	  ';
	  }
	  
	  $B2K = array("arFAMAS","arL85A2","caHK53","caQBZ95B","mgQBB95","mgMG36","srQBU88","srL96","smPP19","sgJackH");
	  $b2k = "";
	  if (in_array($key,$B2K)){
	  	$b2k = '<img src="img/b2k.png" style="position:absolute;margin-left:10px;" />';
	  }
	  
	  $CQ = array("arAUG","arSCARL","mgL86A1","mgLSAT","caACR","caMTAR21","srHK417","srJNG90","sgSPAS12","smM5K");
	  $cq = "";
	  if (in_array($key,$CQ)){
	  	$cq = '<img src="img/cq.png" style="position:absolute;margin-left:10px;" />';
	  }
	  
	  
	  		?>
	  <tr>
	  <td class="result" width="120px" ><?php echo $class; ?><a class="tooltip"><div style="text-align:left;width:120px;margin-left:22px;"><?php echo constant($weaponsName).$b2k.$cq; ?></div>
	  		<span style="margin-top:-55px;margin-left:130px;width:250px;z-index:1000;">
	  			<div style="text-align:center;width:120px;"><b><?php echo constant($weaponsName); ?></b></div><br />
	  			<div style="float:left;"><img src="img/weapons/<?php echo $key; ?>.png" width="120px"/></div><div style="text-align:left;"><?php echo constant($weaponsTEXT); ?></div>
	  			<div style="text-align:center;width:250px;float:left"><hr></div>
	  			<br />
	  			       <div style="margin-bottom:2px;float:right;margin-right:75px;"> <?php
	  			       	if ($data[$key.'_date'] == 0){
	  			       		echo LANG_WEAPONS_NEXT_NO_STAR.'<br />';
	  			       	}else{
	  			       		 echo $EoT->unix_to_time($data[$key.'_date']); 
	  			       		}
	  			       		 ?></div>
	  			       		 <div style="float:left;margin-left:10px;">
	  			       		 <img src="img/stars/stars_back.png" style="float:left;"/>
	  			           <div style="margin-left:<?php echo marginWeaponStars($data[$key.'_count'])-10; ?>px;position:absolute;font-size:11px"><?php echo $data[$key.'_count']; ?></div></div>
	  			       		 <br />
	  			       <div class="DIVtext" style="margin-left:3px;margin-top:5px;float:left;"><?php echo ($data[$key.'_count']+1).LANG_WEAPONS_NEXT_STAR.LANG_WEAPONS_NEXT_NEEDED.($data[$key.'_needed']-$data[$key.'_curr']); ?> Kills</div>
	  		</span>
	  		</a>
	  	</td>	
	  	<?php echo $Star; ?>
	  	
	  	<td class="result" width="90px"><?php echo $EoT->time_complete($data[$key.'_time']); ?></td>
	    <td class="result" width="90px"><?php echo $EoT->points($data[$key.'_kills']); ?></td>
	    <td class="result" width="90px"><?php echo $EoT->points($data[$key.'_headshots']); ?></td>
	    <td class="result" width="90px"><?php echo $EoT->accuracy($data[$key.'_headshots'],$data[$key.'_kills']); ?></td>
	  	<td class="result" width="90px"><?php echo $EoT->points($data[$key.'_shots']); ?></td>
	  	<td class="result" width="90px"><?php echo $EoT->points($data[$key.'_hits']); ?></td>
	  	<td class="result" width="90px"><?php echo number_format($accuracy, 2, ',', ' '); ?>%</td>
	  <td class="result" width="40px"><?php echo $unlocks; ?></td></tr>
	  <?php 
	  } 
	 } 
	  ?>
	</table>
</tbody>


 <script type="text/javascript">
     $(document).ready(function() { 
 jQuery.tablesorter.addParser({
  id: "blank",
  is: function(s, table) {
     return false;
  },
  format: function(s) {
    return jQuery.tablesorter.formatFloat(s.replace(/ /g, ""));
  },
  type: "numeric"
});
    $("#weapons").tablesorter({ 
        headers: { 
            0: {   
                sorter: false 
            }, 
             1: {   
                sorter: false 
            },   
             3: {   
                sorter: 'blank' 
            },                
             4: {   
                sorter: 'blank' 
            },    
             6: {   
                sorter: 'blank' 
            },    
             7: {   
                sorter: 'blank' 
            },   
            
        } 
     
    }); 
});
 </script>
 
	  <script type="text/javascript">
		$(document).ready(function() {
	
			$("a#bf3statsUnlocks").fancybox({
			'autoDimensions'	: true,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'padding' : 0,
      'overlayColor'		: '#000',
			'overlayOpacity'	: 0.6
	   });
   });
	</script> 
	
	 
	
	
	<?php 
 function marginWeaponStars($count){
	if ($count >= 10 && $count <= 99){
		$return = 37;
	}else if ($count >= 100){
		$return = 35;
	}else{
		$return = 40;
	}
	
	return $return;
}

