<?php
require_once 'core/sys.php';
require_once 'core/func_war.php';
include 'core/func_next_level.php';
include 'core/func_online.php';
include 'core/func_time.php';
reg();
head('Мой персонаж');




/* Cкладываем предметы */
	require_once 'inc/user_item.php';
	$arm = 0;
	$arm = $arm+$armor1['defense']+$helmet1['defense']+$shoes1['defense']+$gloves1['defense'];
	
	$defense = $user['defense']+$arm;
	/* Считаем оружие */
	$weapon = $user['strength']+$weapon1['strength'];
/* ----- */
$pers = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `pers` WHERE `id`='".$user['pers']."'"));

	if(empty($user['status'])){
	$user['status']= '.....';
	}
///////////////////////
echo '<div class="row" id="pers">
<div class="status"><a href="lk.php?status">'.$user['status'].'</a><span class="arrow"></span></div><br><br>
<img src="img/pers/'.$user['pers'].'.png" alt="Персонаж">';
	if($user['weapon']>0){
	echo ' <img src="'.$weapon1['img'].'"><br>';
	}
	if($user['armor']>0){
	echo '<img src="'.$armor1['img'].'"> ';
	}
	if($user['helmet']>0){
	echo '<img src="'.$helmet1['img'].'"> ';
	}
	if($user['shoes']>0){
	echo '<img src="'.$shoes1['img'].'"> ';
	}
	if($user['gloves']>0){
	echo '<img src="'.$gloves1['img'].'"> ';
	}
	if($user['amulet']>0){
	echo '<img src="'.$amulet1['img'].'"> ';
	}
echo '</div>';
if($user['virus']>0){
$virus = mysql_fetch_assoc(mysql_query("SELECT `name`,`img`,`virus` FROM `inventory` WHERE `id`='".$user['virus']."'"));
echo '<div class="name">Заражен вирусом: <img src="'.$virus['img'].'" alt=""><br>Реген. HP -'.$virus['virus'].'<br></div>';
}
	if($user['clan']>0){
	$clan_name = mysql_fetch_assoc(mysql_query("SELECT * FROM `clan` WHERE `id`='".$user['clan']."' LIMIT 1"));
	$rang = mysql_fetch_assoc(mysql_query("SELECT * FROM `clan_rang` WHERE `oput2`>='".$user['clan_oput']."' ORDER BY `id` LIMIT 1"));
	$clan = 'Состою в клане: <img src="img/clan/'.$user['clan'].'.'.$clan_name['img'].'" width="20" height="20" alt=""> <a href="clan.php?clan='.$user['clan'].'">'.$clan_name['name'].'</a> ['.$clan_name['level'].'] <img src="img/rang/'.$rang['id'].'.jpg"><br>';
	}else{
	$clan='';
	}
		/* подарки */
	$present_c= mysql_result(mysql_query("SELECT COUNT(id) FROM `presents_user` WHERE `to_id`='".$user['id']."'"),0);
	if($present_c>0){
	echo '<div class="row" id="center">';
	$present_q = mysql_query("SELECT `present_id` FROM `presents_user` WHERE `to_id`='".$user['id']."' ORDER BY `time` DESC LIMIT 4");
		while($present = mysql_fetch_assoc($present_q)){
		echo '<a href="presents.php?view&ank='.$user['id'].'"><img src="img/presents/present'.$present['present_id'].'.png"></a>';
		}
	echo '</div>';
	}
	#############
echo '<div class="row">
'.$pers['name'].'<br>
'.$clan;
	if($user['aura_vamp']==0 and $user['dnk_oboroten']==0 and $user['dnk_roso']==0){
	echo 'Обновленные ДНК: нет<br>';
	}else{
	echo 'Обновленные ДНК: ';
		if($user['aura_vamp']>0){
		echo '<img src="img/other/aura_vamp.png" width="16" height="16"> ';
		}
		if($user['dnk_oboroten']>0){
		echo '<img src="img/other/dnk_oboroten.png" width="16" height="16"> ';
		}
		if($user['dnk_roso']>0){
		echo '<img src="img/other/dnk_roso.png" width="16" height="16"> ';
		}
		echo '<br>';
	}

/* Крит */
$crit_us = round($user['level']/3.75,2);
////////
echo 'Уровень: '.$user['level'].'<br>
До следующего уровня: '.$level_ost.' опыта<br>
Опыт: '.$user['oput'].'/'.$row_level['oput'].'<br>
Побед: '.$user['win'].'<br> 
Поражений: '.$user['not_win'].'<br>
Критический удар: '.$crit_us.'%<br>
Сила: '.$weapon.'<br>Защита: '.$defense.'<br>
Атака: '.uron($weapon).'-'.rand_uron($weapon).'<br>
Золото: <img src="img/money/money.png" alt=""> '.$user['money'].'<br>
Рубины: <img src="img/money/rubin.png" alt=""> '.$user['rubin'].'<br></div>';
echo '<div class="name">
В игре: '.Sec2Time($user['in_game']).'<br>
Последняя активность: '.clock($user['time']).'<br>
Дата регистрации: '.clock($user['reg_time']).'<br>
</div>';
if($user['train']>0){
echo '<div class="text"><a href="train.php">Тренировка навыков</a> ['.$user['train'].']</div>';
}
foot();
?>