<?
include './system/common.php';   
include './system/functions.php';
include './system/user.php';
    
if(!$user) {
header('location: /');  
exit;}

$id = _string(_num($_GET['id']));                                                        
$shop = mysql_query('SELECT * FROM `shop` WHERE `id` = "'.$id.'"');
$shop = mysql_fetch_array($shop);
 
  if(!$shop) {
header('location: /');
exit;}
 
  $item = mysql_query('SELECT * FROM `items` WHERE `id` = "'.$shop['id'].'"');
  $item = mysql_fetch_array($item);

$title = $item['name'];
include './system/h.php';

  $quality = [	'1'=>'Обычный',
				'2'=>'Необычный',
				'3'=>'Редкий',
				'4'=>'Эпический',
				'5'=>'Легендарный',
				'6'=>'Мифический'
		];
$quality_color=['1'=>'#999999',
				'2'=>'#B1D689',
				'3'=>'#6BA0E7',
				'4'=>'#C780DB',
				'5'=>'#FF8E94',
				'6'=>'#FE7E01'
		];
		
$w = [	'1'=>'Голова',
		'2'=>'Плечи',
		'3'=>'Торс',
		'4'=>'Перчатки',
		'5'=>'Левая рука',
		'6'=>'Правая рука',
		'7'=>'Ноги',
		'8'=>'Обувь'
		];


echo'<div class="title">'.$title.'</div>';
echo'<div class="empty_block">
<table cellpadding="0" cellspacing="0">
<tr>
  <td width="15%"><img src="/images/items/'.$item['id'].'.png" alt="*"/></td>
  <td><img src="/images/ico/quality/'.$item['quality'].'.png" alt="*"/> <font color="#fff"> '.$item['name'].' </font>
  <br/><small><font color="#'.(($user['level'] < $item['skill']) ? 'c06060':'ffffff').'"><img src="/images/ico/png/up.png" alt="*" width="12"/>'.$item['skill'].' ур, </font>
  <font color="'.$quality_color[$item['quality']].'"> '.$quality[$item['quality']].' </font>, '.$w[$item['w']].'<br/> 
</small></td>
</tr></table>
</div>
  <div class="line"></div>
<div class="empty_block">';


    $equip_item = mysql_query('SELECT * FROM `inv` WHERE `id` = "'.$user['w_'.$item['w']].'"');
    $equip_item = mysql_fetch_array($equip_item);

    $diff = 0;



echo'<img src="/images/ico/png/attack.png" alt="*"/> Сила: <font color="';
  
if($shop['_str'] > $equip_item['_str']) {
$diff += $shop['_str'] - $equip_item['_str'];
echo'#3c3';
}else{
echo'#c66';
}
echo'"> '.$shop['_str'].'</font><br/>';


echo'<img src="/images/ico/png/hp.png" alt="*"/> Жизнь: <font color="';
if($shop['_vit'] > $equip_item['_vit']) {
$diff += $shop['_vit'] - $equip_item['_vit'];
echo'#3c3'; 
}else{
echo'#c66';
}
echo'"> '.$shop['_vit'].'</font><br/>';


echo'<img src="/images/ico/png/def.png" alt="*"/> Защита: <font color="';
if($shop['_def'] > $equip_item['_def']) {
$diff += $shop['_def'] - $equip_item['_def'];
echo'#3c3'; 
}else{
echo'#c66';
}
echo'"> '.$shop['_def'].' </font><br/>';

  
  

    if($shop['_str'] > $equip_item['_str'] OR $shop['_vit'] > $equip_item['_vit'] OR $shop['_def'] > $equip_item['_def']) {
echo' <font color="#3c3">Лучше +'.$diff.'</font>';
}

echo'</div><div class="line"></div>
<div class="block_link"><a href="/invasion_info"><img src="/images/ico/png/back.png" alt="*"/> Вернуться </a></div>
<div class="line"></div>';
include './system/f.php';

?>