<?
require_once '../core/system.php';
echo only_reg();
$sila = (5+(($user['sila']-80)*2));
$max_health = (5+(($user['max_health']-80)*2));
$lovk = (5+(($user['lovk']-80)*2));
$zashit = (5+(($user['zashit']-80)*2));
$max_mana = (5+(($user['max_mana']-1050)*2));
$header = 'Тренировка';
require_once '../core/head.php';
switch($act) {
case 'sila':
if($user[sila] < 10000){
if($user[gold] < $sila){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$sila)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `sila` = '".($user['sila']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Параметр успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Параметр прокачен максемально!';
exit();
}
break;
case 'health':
if($user[max_health] < 10000){
if($user[gold] < $max_health){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$max_health)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `max_health` = '".($user['max_health']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Параметр успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Параметр прокачен максемально!';
exit();
}
break;
case 'lovk':
if($user[lovk] < 10000){
if($user[gold] < $lovk){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$lovk)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `lovk` = '".($user['lovk']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Параметр успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Параметр прокачен максемально!';
exit();
}
break;
case 'zashit':
if($user[zashit] < 10000){
if($user[gold] < $zashit){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$zashit)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `zashit` = '".($user['zashit']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Параметр успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Параметр прокачен максемально!';
exit();
}
break;
case 'mana':
if($user[max_mana] < 6000){
if($user[gold] < $max_mana){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$max_mana)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `max_mana` = '".($user['max_mana']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Параметр успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Параметр прокачен максемально!';
exit();
}
break;
default;
echo "<div class='player center blue'>Прокачевай своего героя и стань самым сильным Героем!</div>";
echo "<div class='mini-line'></div>";
echo "<div class='player'>";
echo "Сила: $user[sila]<br>";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(10000/($user[sila]+1)))."%'></div>";
echo "</div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=sila'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $sila</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo "Здоровье: $user[max_health]<br>";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(10000/($user[max_health]+1)))."%'></div>";
echo "</div>";
echo "</div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=health'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $max_health</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo "Ловкость: $user[lovk]<br>";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(10000/($user[lovk]+1)))."%'></div>";
echo "</div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=lovk'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $lovk</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo "Защита: $user[zashit]<br>";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(10000/($user[zashit]+1)))."%'></div>";
echo "</div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=zashit'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $zashit</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo "Мана: $user[max_mana]<br>";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(6000/($user[max_mana]+1)))."%'></div>";
echo "</div>";
echo "<div class='center'>Тренировка временно не доступна";
// echo "<a class='btn' href='?act=mana'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $max_mana</span></span></a>";
echo "</div>";
echo "</div>";
}
require_once '../core/foot.php';
?>