<?php
require_once '../core/system.php';
echo only_reg();
$umensila = (50+(($user['umensila']-8)*5));
$umenmax_health = (50+(($user['umenmax_health']-8)*5));
$umenlovk = (50+(($user['umenlovk']-8)*5));
$umenzashit = (50+(($user['umenzashit']-8)*5));
$umenmax_mana = (50+(($user['umenmax_mana']-8)*5));
$header = 'Навыки';
require_once '../core/head.php';
switch($act) {
case 'umensila':
if($user[umensila] < 100){
if($user[gold] < $umensila){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
if($user['umensila'] < 30){
$sila = 5;
}
if($user['umensila'] >= 30){
$sila = 15;
}
if($user['umensila'] >= 50){
$sila = 25;
}
if($user['umensila'] >= 70){
$sila = 40;
}
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$umensila)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umensila` = '".($user['umensila']+5)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `sila` = '".($user['sila']+$sila)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umen` = '".($user['umen']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Навык успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Навык  прокачено максимально!';
exit();
}
break;
case 'umenhealth':
if($user[umenmax_health] < 100){
if($user[gold] < $umenmax_health){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
if($user['umenmax_health'] < 30){
$health = 5;
}
if($user['umenmax_health'] >= 30){
$health = 15;
}
if($user['umenmax_health'] >= 50){
$health = 25;
}
if($user['umenmax_health'] >= 70){
$health = 40;
}
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$umenmax_health)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umenmax_health` = '".($user['umenmax_health']+5)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `max_health` = '".($user['max_health']+$health)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umen` = '".($user['umen']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Навык успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Навык прокачено максимально!';
exit();
}
break;
case 'umenlovk':
if($user[umenlovk] < 100){
if($user[gold] < $umenlovk){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
if($user['umenlovk'] < 30){
$lovk = 5;
}
if($user['umenlovk'] >= 30){
$lovk = 15;
}
if($user['umenlovk'] >= 50){
$lovk = 25;
}
if($user['umenlovk'] >= 70){
$lovk = 40;
}
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$umenlovk)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umenlovk` = '".($user['umenlovk']+5)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `lovk` = '".($user['lovk']+$lovk)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umen` = '".($user['umen']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Навык успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Навык прокачено максимально!';
exit();
}
break;
case 'umenzashit':
if($user[umenzashit] < 100){
if($user[gold] < $umenzashit){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
if($user['umenzashit'] < 30){
$zashit = 5;
}
if($user['umenzashit'] >= 30){
$zashit = 15;
}
if($user['umenzashit'] >= 50){
$zashit = 25;
}
if($user['umenzashit'] >= 70){
$zashit = 40;
}
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$umenzashit)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umenzashit` = '".($user['umenzashit']+5)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `zashit` = '".($user['zashit']+$zashit)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umen` = '".($user['umen']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'Навык успешно повышен!';
exit();
}
}else{
header('Location: ?');
$_SESSION['err'] = 'Навык прокачено максимально!';
exit();
}
break;
case 'umenmana':
if($user[umenmax_mana] < 100){
if($user[gold] < $umenmax_mana){
header('Location: ?');
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}else{
if($user['umenmax_mana'] < 30){
$mana = 5;
}
if($user['umenmax_mana'] >= 30){
$mana = 15;
}
if($user['umenmax_mana'] >= 50){
$mana = 25;
}
if($user['umenmax_mana'] >= 70){
$mana = 40;
}
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-$umenmax_mana)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umenmax_mana` = '".($user['umenmax_mana']+5)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `max_mana` = '".($user['max_mana']+$mana)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `umen` = '".($user['umen']+1)."' 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"<img class='float-left' src='/
images/ability/1.6.png' width='35' height='35'/> <img src='/images/icon/quality/5.png' alt='*'/><font color='#aa591d'> Ярость титана:</font></br>
Бонус: <font color='#71cc71'>
</font> к силе</br>
 Процент прокачки: <font
color='#71cc71'>$user[umensila]%</font></br>"; 
echo "<div class='progress' style='width:".round(1/(100/($user[umensila]+10)))."%'></div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=umensila'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $umensila</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo"<img class='float-left' src='/
images/ability/2.6.png' width='35' height='35'/> <img src='/images/icon/quality/5.png' alt='*'/><font color='#aa591d'> Крепкая броня:</font> </br>
Бонус: <font color='#71cc71'>
</font> к здоровью</br>
 Процент прокачки: <font color='#71cc71'>$user[umenmax_health]%</font></br>";
echo "<div class='progress' style='width:".round(1/(100/($user[umenmax_health]+1)))."%'></div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=umenhealth'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $umenmax_health</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo"<img class='float-left' src='/
images/ability/3.6.png' width='35' height='35'/> <img src='/images/icon/quality/5.png' alt='*'/><font color='#aa591d'> Скорость атаки:</font></br>
 Бонус: <font color='#71cc71'>
</font> к ловкости</br>
Процент прокачки: <font
color='#71cc71'>$user[umenlovk]%</font></br>"; 
echo "<div class='progress' style='width:".round(1/(100/($user[umenlovk]+1)))."%'></div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=umenlovk'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $umenlovk</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo"<img class='float-left' src='/
images/ability/4.6.png' width='35' height='35'/> <img src='/images/icon/quality/5.png' alt='*'/><font color='#aa591d'> Защитная стойка:</font> </br>
Бонус: <font color='#71cc71'>
</font>к защите</br>
 Процент прокачки: <font color='#71cc71'>$user[umenzashit]%</font></br>"; 
echo "<div class='progress' style='width:".round(1/(100/($user[umenzashit]+1)))."%'></div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=umenzashit'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $umenzashit</span></span></a>";
echo "</div>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>";
echo" <img class='float-left' src='/
images/ability/5.6.png' width='35' height='35'/> <img src='/images/icon/quality/5.png' alt='*'/><font color='#aa591d'> Приток маны:</font> </br>
Бонус: <font color='#71cc71'>
</font>к мане</br>
 Процент прокачки: <font color='#71cc71'>$user[umenmax_mana]%</font></br>";
echo "<div class='progress' style='width:".round(1/(100/($user[umenmax_mana]+1)))."%'></div>";
echo "<div class='center'>";
echo "<a class='btn' href='?act=umenmana'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png'> $umenmax_mana</span></span></a>";
echo "</div>";
echo "</div>";
if (!empty($user['umensila']))
{
$sila = true;
}
if (!empty($user['umenlovk']))
{
$lovk = true;
}
if (!empty($user['umenmax_health'])){
$max_health = true;
}
if (!empty($user['umenzashit']))
{
$zashit = true;
}

if (!empty($user['umenmax_mana']))
{
$max_mana = true;
}
echo "<div class='dot-line'></div>
<ul
class='hint'><li>Навыки дают не плохой плюс к вашим параметрам
</li>
</ul>";
echo "</div>";
}
require_once '../core/foot.php';
?>