<?php
include_once ('./core/base.php');
falseauth();

$id=fl($_GET['id']);

$skill = $base -> query('SELECT * FROM `users_skills` WHERE `id` = "'.$id.'" LIMIT 1') -> fetch_assoc();

$header = ''.$skill['name'].'';

include_once ('./core/head.php');

if($skill != 0) {

echo '<div class="b"><div class="title">'.$skill['name'].'</div>';

echo ''.user_skill($skill['id']).'';

echo '<div class="line"></div><center><small>'.$skill['description'].'</small></center><div class="line"></div>';

if($skill['type'] == 'buff'){
	if($skill['p_att']>0) $skill['p_att']='<font color="#30C530">+'.$skill['p_att'].'</font>';
	if($skill['p_def']>0) $skill['p_def']='<font color="#30C530">+'.$skill['p_def'].'</font>';
	if($skill['m_att']>0) $skill['m_att']='<font color="#30C530">+'.$skill['m_att'].'</font>';
	if($skill['m_def']>0) $skill['m_def']='<font color="#30C530">+'.$skill['m_def'].'</font>';
	if($skill['endurance']>0) $skill['endurance']='<font color="#30C530">+'.$skill['endurance'].'</font>';
	if($skill['intellect']>0) $skill['intellect']='<font color="#30C530">+'.$skill['intellect'].'</font>';
	if($skill['agility']>0) $skill['agility']='<font color="#30C530">+'.$skill['agility'].'</font>';
	if($skill['skill']>0) $skill['skill']='<font color="#30C530">+'.$skill['skill'].'</font>';
}elseif($skill['type'] == 'debuff'){
	if($skill['p_att']>0) $skill['p_att']='<font color="#D21818">-'.$skill['p_att'].'</font>';
	if($skill['p_def']>0) $skill['p_def']='<font color="#D21818">-'.$skill['p_def'].'</font>';
	if($skill['m_att']>0) $skill['m_att']='<font color="#D21818">-'.$skill['m_att'].'</font>';
	if($skill['m_def']>0) $skill['m_def']='<font color="#D21818">-'.$skill['m_def'].'</font>';
	if($skill['endurance']>0) $skill['endurance']='<font color="#D21818">-'.$skill['endurance'].'</font>';
	if($skill['intellect']>0) $skill['intellect']='<font color="#D21818">-'.$skill['intellect'].'</font>';
	if($skill['agility']>0) $skill['agility']='<font color="#D21818">-'.$skill['agility'].'</font>';
	if($skill['skill']>0) $skill['skill']='<font color="#D21818">-'.$skill['skill'].'</font>';
}

echo '<div class="title">Характеристики</div>';

echo '<table class="table table-common" style="margin-top: 5px; border-collapse: collapse; text-align: left;">';
if($skill['type'] == 'attack'){
	if($skill['type_attack'] == 'p_att'){
		$type_attack = 'Физ.';
	}else{
		$type_attack = 'Маг.';
	}
	echo '<tr><td><img src="/images/icons/'.$skill['type_attack'].'.png"> '.$type_attack.' Атака</td><td><center>'.$skill['how_many'].'</center></td><td><img src="/images/icons/time.png"> Откат</td><td><center>'.$skill['cool_down'].'с.</center></td></tr>';
}elseif($skill['type'] == 'heal' OR $skill['type'] == 'massive_heal'){
	echo '<tr><td><img src="/images/icons/heal.png"> Лечение</td><td><center>'.$skill['how_many'].'</center></td><td><img src="/images/icons/time.png"> Откат</td><td><center>'.$skill['cool_down'].'с.</center></td></tr>';
}elseif($skill['type'] == 'buff' OR $skill['type'] == 'debuff'){
	echo '<tr><td><img src="/images/icons/p_att.png"> Физ. Атака</td><td><center>'.$skill['p_att'].'</center></td><td><img src="/images/icons/endurance.png"> Выносливость</td><td><center>'.$skill['endurance'].'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/p_def.png"> Физ. Защита</td><td><center>'.$skill['p_def'].'</center></td><td><img src="/images/icons/intellect.png"> Интеллект</td><td><center>'.$skill['intellect'].'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/m_att.png"> Маг. Атака</td><td><center>'.$skill['m_att'].'</center></td><td><img src="/images/icons/agility.png"> Ловкость</td><td><center>'.$skill['agility'].'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/m_def.png"> Маг. Защита</td><td><center>'.$skill['m_def'].'</center></td><td><img src="/images/icons/skill.png"> Мастерство</td><td><center>'.$skill['skill'].'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/time.png"> Откат</td><td><center>'.$skill['cool_down'].'с.</center></td><td><img src="/images/icons/duration.png"> Длительность</td><td><center>'.$skill['duration'].'с.</center></td></tr>';
}
echo '<tr><td colspan="2"><img src="/images/icons/book.png"> Затраты маны</td><td  colspan="2"><center>'.$skill['mp_need'].'</center></td></tr>';
echo '</table>';

echo '<br/><a class="btn" href="javascript:history.go(-1)"><img src="/images/icons/back.png"> Назад</a>';

echo '</div>';

}else{
header('Location: /skills/');
}


include_once ('./core/foot.php');
?>