<?php

$user=$ku;
clear_arena();
$arena_o = mysql_fetch_array(mysql_querll("SELECT * FROM `arena` WHERE `oponent` = '$ku[nick]'"));
$arena_w = mysql_fetch_array(mysql_querll("SELECT * FROM `arena` WHERE `lider` = '$ku[nick]'"));
if($arena_o['oponent'] == $user['nick']) header('Location: ?go_boy');
if($arena_w['lider'] == $user['nick'])  header('Location: ?go_boy');



$cena1 = cpgs($ku['arena1']);
$cena2 = cpgs($ku['arena2max']);
$cena3 = cpgs($ku['arena3']);
$cena4 = cpgs($ku['arena4']);
$cena5 = cpgs($ku['arena5']);
if($ku['arena2'] == 1) $hps = 10;
if($ku['arena2'] == 2) $hps = 20;
if($ku['arena2'] == 3) $hps = 30;
if($ku['arena2'] == 4) $hps = 40;
if($ku['arena2'] == 5) $hps = 50;
if($ku['arena2'] == 6) $hps = 60;
if($ku['arena2'] == 7) $hps = 70;
if($ku['arena2'] == 8) $hps = 80;
if($ku['arena2'] == 9) $hps = 90;
if($ku['arena2'] == 10) $hps = 100;
if($ku['arena2'] == 11) $hps = 110;
if($ku['arena2'] == 12) $hps = 120;
if($ku['arena2'] == 13) $hps = 130;
if($ku['arena2'] == 14) $hps = 140;
if($ku['arena2'] == 15) $hps = 150;
if($ku['arena2'] == 16) $hps = 160;
if($ku['arena2'] == 17) $hps = 170;
if($ku['arena2'] == 18) $hps = 180;
if($ku['arena2'] == 19) $hps = 190;
if($ku['arena2'] == 20) $hps = 200;
if($ku['arena2'] == 21) $hps = 210;
if($ku['arena2'] == 22) $hps = 220;
if($ku['arena2'] == 23) $hps = 230;
if($ku['arena2'] == 24) $hps = 240;
if($ku['arena2'] == 25) $hps = 250;
if($ku['arena2'] == 26) $hps = 260;
if($ku['arena2'] == 27) $hps = 270;
if($ku['arena2'] == 28) $hps = 280;
if($ku['arena2'] == 29) $hps = 290;
if($ku['arena2'] == 30) $hps = 300;
if($ku['arena2'] == 31) $hps = 310;
if($ku['arena2'] == 32) $hps = 320;
if($ku['arena2'] == 33) $hps = 330;
if($ku['arena2'] == 34) $hps = 340;
if($ku['arena2'] == 35) $hps = 350;
if($ku['arena2'] == 36) $hps = 360;
if($ku['arena2'] == 37) $hps = 370;
if($ku['arena2'] == 38) $hps = 380;
if($ku['arena2'] == 39) $hps = 390;
if($ku['arena2'] == 40) $hps = 400;
if ($ku['hp_time'] < time()) 
{ 
if(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$ku[id]' AND `arena2max` < '3000'"),0))

{

mysql_querll("UPDATE `kolhoz_user` SET `arena2`=(`arena2`+1), `hp_time`=(UNIX_TIMESTAMP()+10) WHERE `hp_time`<UNIX_TIMESTAMP() AND `id` = '$ku[id]'");
}
}else{

}
if(isset($_GET['noLinkLevelFermerUser'])) echo "<div class='feedback'><ul><li class='title'><span>Извините, но по критериям создателя боя вы не подходите!</span></li><li></li></ul></div>";
if(isset($_GET['noLinkHpFermerUser'])) echo "<div class='feedback'><ul><li class='title'><span>Извините, но у вас 0 hp !</span></li><li></li></ul></div>";
if(isset($_GET['LinkGoUserEnd'])) echo "<div class='feedback'><ul><li class='title'><span>Бой закончен, вышло время или вы проиграли!</span></li><li></li></ul></div>";
if(isset($_GET['rulesArena'])) echo "<div class='feedback'><ul><li class='title'><span>Правила еще не придумал Администратор!</span></li><li></li></ul></div>";
if(isset($_GET['GoLinkUserAdd'])) echo "<div class='feedback'><ul><li class='title'><span>Вы победили!</span></li><li></li></ul></div>";
if(isset($_GET['GoLinkNoRubies'])) echo "<div class='feedback'><ul><li class='title'><span>Не хватает кредитов!</span></li><li></li></ul></div>";
if(isset($_GET['GoLinkNoMoney'])) echo "<div class='feedback'><ul><li class='title'><span>Не хватает монет!</span></li><li></li></ul></div>";







echo "<div class='content'>";
echo '<div class="block"><div>';



echo '<img width="16" height="16" src="/images/icons/refresh.png" alt="*"/>
<a href="?arena">Обновить</a><span class="minor"> Тут можете пополнить жизни </span>
</div><div>
<img width="16" height="16" src="/images/icons/eye.png" alt="*"/>
<a href="?ArenaLinkHistory">История боев</a>
</div>';

echo '<img alt="" width="16" height="16" src="/images/icons/rules.png"/> <a href="?arena&amp;rulesArena">Правила</a>';
echo '<div><img width="16" height="16" src="/images/icons/sword.png" alt="o"/> <a href="?ArenaLinkBoy">Просмотр заявок</a> <span class="title">('.mysql_result(mysql_querll("select count(*) from `arena` "),0).')</span></div><br />'.($ku['arena2']<$ku['arena2max']?'<div><img width="16" height="16" src="/images/icons/heart.png" alt="o"/> <a href="?arena&hp1">Востановить 10 hp</a> (5000<img width="16" height="16" src="/images/icons/money.png" alt="o"/>)<br><img width="16" height="16" src="/images/icons/heart.png" alt="o"/> <a href="?arena&hp_all">Востановить всё здоровье</a> (25<img width="16" height="16" src="/images/icons/ruby.png" alt="o"/>)</div><br>':null).'';
if(isset($_GET['hp1']) && $ku['arena2']<$ku['arena2max'])
{
if($ku['money']<5000)
{
header("Location:?arena&GoLinkNoMoney");
} else {
mysql_querll("UPDATE `kolhoz_user` SET `arena2` = '".($ku['arena2']+10)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-5000)."' WHERE `id` = '$ku[id]'");
header("Location:?arena");
}
}
if(isset($_GET['hp_all']) && $ku['arena2']<$ku['arena2max'])
{
if($ku['rubies']<25)
{
header("Location:?arena&GoLinkNoRubies");
} else {
mysql_querll("UPDATE `kolhoz_user` SET `arena2` = '".($ku['arena2max'])."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-25)."' WHERE `id` = '$ku[id]'");
header("Location:?arena");
}
}



echo '<div><img width="16" height="16" src="/images/icons/abilities.png" alt="o"/> <span class="epic">Способности</span> (Побед: '.$ku['arena_win'].')</div><br><div>';
echo '<ul>
<li>

<img width="16" height="16" src="/images/icons/sword.png" alt="o"/> <span class="epic">Мощность</span>
<span class="title">'.$ku['arena1'].' </span> (Это Ваш уровень)
<span class="minor">(<span>  <a href="?arena&amp;LinkGetOkArena1"><img width="16" height="16" src="/images/icons/up.png" alt="o"/></a> <img width="16" height="16" src="/images/icons/ruby.png" alt="o"/> '.$cena1.'</span>)</span>
</li> (Умножает удар от 1 ~ 5 урона)<li><br />
<img width="16" height="16" src="/images/icons/heart.png" alt="o"/>
<span class="epic"><b>'.$ku['arena2'].' / '.$ku['arena2max'].'</b>:  Живучести </span>';
echo '<span class="title">Уровень: '.$ku['arena2max'].' '.@$level_hp.'</span>
<span class="minor">(<span>  <a href="?arena&amp;LinkGetOkArena2"><img width="16" height="16" src="/images/icons/up.png" alt="o"/></a> <img width="16" height="16" src="/images/icons/ruby.png" alt="o"/>  '.$cena2.'</span>)</span>
</li> (Каждый уровень увеличивает жизни)<li><br />
<img width="16" height="16" src="/images/icons/lightning.png" alt="o"/>
<span class="epic">Критический удар</span>
<span class="title">'.$ku['arena4'].'</span> 
<span class="minor">(<span>  <a href="?arena&amp;LinkGetOkArena4"><img width="16" height="16" src="/images/icons/up.png" alt="o"/></a> <img width="16" height="16" src="/images/icons/ruby.png" alt="o"/> '.$cena4.'</span>)</span>
</li>(Увеличивает опыт при победе)<li><br />
<img width="16" height="16" src="/images/icons/shield.png" alt="o"/>
<span class="epic">Защита</span>
<span class="title">'.$ku['arena3'].'</span> 
<span class="minor">(<span>  <a href="?arena&amp;LinkGetOkArena3"><img width="16" height="16" src="/images/icons/up.png" alt="o"/></a> <img width="16" height="16" src="/images/icons/ruby.png" alt="o"/> '.$cena3.'</span>)</span>
</li>(Уменьшает удар соперника на % уровня защиты)<li><br />
<img width="16" height="16" src="/images/icons/money.png" alt="o"/>
<span class="epic">Экономия</span>
<span class="title">'.$ku['arena5'].'</span>
<span class="minor">(<span>  <a href="?arena&amp;LinkGetOkArena5"><img width="16" height="16" src="/images/icons/up.png" alt="o"/></a> <img width="16" height="16" src="/images/icons/ruby.png" alt="o"/> '.$cena5.'</span>)</span>
</li>(С каждым уровнем умножает жизни в победе над соперником, на уровень критического удара!) 

</ul>';
////////////////////////////////////////////////////// Начало поднятия рейтинга ////////////////////////////////////////////////////////////////////////
if(isset($_GET['LinkGetOkArena1'])){
if($ku['rubies']>=$cena1){
$cer = 1;
mysql_querll("UPDATE `kolhoz_user` SET `arena1` = '".($ku['arena1']+1)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena1)."' WHERE `id` = '$ku[id]'");
header("Location:?arena");
exit();
}
else
{
no_rubies($cena1-$ku['rubies']);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(isset($_GET['LinkGetOkArena2']))
{
if($ku['rubies']>=$cena2)
{
mysql_querll("UPDATE `kolhoz_user` SET `arena2max` = '".($ku['arena2max']+10)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena2)."' WHERE `id` = '$ku[id]'");
header("Location:?arena");
exit;
}
else
{
no_rubies($cena2-$ku['rubies']);
}
header("Location:?arena");
}
if(isset($_GET['LinkGetOkArena3']))
{
if($ku['rubies']>=$cena3)
{
mysql_querll("UPDATE `kolhoz_user` SET `arena3` = '".($ku['arena3']+1)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena3)."' WHERE `id` = '$ku[id]'");
header("Location:?arena&".passgen());
exit;
}
else
{
no_rubies($cena3-$ku['rubies']);
}
header("Location:?arena");
}
if(isset($_GET['LinkGetOkArena4']))
{
if($ku['rubies']>=$cena4)
{
mysql_querll("UPDATE `kolhoz_user` SET `arena4` = '".($ku['arena4']+1)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena4)."' WHERE `id` = '$ku[id]'");
header("Location:?arena&".passgen());
exit;
}
else
{
no_rubies($cena4-$ku['rubies']);
}
header("Location:?arena");
}
if(isset($_GET['LinkGetOkArena5']))
{
if($ku['rubies']>=$cena5)
{
mysql_querll("UPDATE `kolhoz_user` SET `arena5` = '".($ku['arena5']+1)."' WHERE `id` = '$ku[id]'");
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena5)."' WHERE `id` = '$ku[id]'");
header("Location:?arena");
exit;
}
else
{
no_rubies($cena5-$ku['rubies']);
}
}

////////////////////////////////////////////////////// Конец поднятия рейтинга


echo '</div>
</div>';
include_once 'inc/foot.php';

	
?>