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

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

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

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

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

if($res != 0 AND $res['what'] != 'clothing') {

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

echo ''.res($res['id']).'';

echo '<div class="title">Информация</div>';

if($res['what'] == 'resource'){
	echo '<table class="table table-common" style="margin-top: 5px; border-collapse: collapse; text-align: left;">';
	echo '<tr><td><img src="/images/icons/money_bag.png"> Стоимость</td><td><center>'.n_f($res['cost']).'</center></td></tr>';
	echo '</table>';
}elseif($res['what'] == 'potion'){
	echo '<table class="table table-common" style="margin-top: 5px; border-collapse: collapse; text-align: left;">';
	if($res['potion'] == 'hp') echo '<tr><td><img src="/images/icons/hp_regen.png"> Восстановление здоровья</td><td><center>'.$res['hp_regen'].'</center></td></tr>';
	if($res['potion'] == 'mp') echo '<tr><td><img src="/images/icons/mp_regen.png"> Восстановление маны</td><td><center>'.$res['mp_regen'].'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/money_bag.png"> Стоимость</td><td><center>'.n_f($res['cost']).'</center></td></tr>';
	echo '</table>';
}elseif($res['what'] == 'scroll'){
	if($res['mark'] == 0) $chance = 5;
	if($res['mark'] == 1) $chance = 10;
	if($res['mark'] == 2) $chance = 20;
	if($res['mark'] == 3) $chance = 35;
	if($res['mark'] == 4) $chance = 50;
	echo '<table class="table table-common" style="margin-top: 5px; border-collapse: collapse; text-align: left;">';
	echo '<tr><td><img src="/images/icons/hammer.png"> Шанс успешной заточки</td><td><center>'.$chance.'%</center></td></tr>';
	echo '<tr><td><img src="/images/icons/money_bag.png"> Стоимость</td><td><center>'.n_f($res['cost']).'</center></td></tr>';
	echo '</table>';
}elseif($res['what'] == 'rune'){
	if($res['mark'] == 1) $power = 5;
	if($res['mark'] == 2) $power = 10;
	if($res['mark'] == 3) $power = 15;
	if($res['mark'] == 4) $power = 20;
	if($res['rune_type'] == 'endurance') $what = 'выносливости';
	if($res['rune_type'] == 'intellect') $what = 'интеллекта';
	if($res['rune_type'] == 'agility') $what = 'ловкости';
	if($res['rune_type'] == 'skill') $what = 'мастерства';
	echo '<table class="table table-common" style="margin-top: 5px; border-collapse: collapse; text-align: left;">';
	echo '<tr><td><img src="/images/icons/'.$res['rune_type'].'.png"> Усиление '.$what.'</td><td><center>'.$power.'</center></td></tr>';
	echo '<tr><td><img src="/images/icons/money_bag.png"> Стоимость</td><td><center>'.n_f($res['cost']).'</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: /inventory/res/');
exit;
}


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