<?
require_once 'core/system.php';
echo only_reg();
$header = 'Амфитеатр';
require_once 'core/head.php';
// Не знаю что за Пит, поэтому комментирую, 
// так как вызывает ошибку. // Ele Loan
//$pit = mysql_fetch_assoc(mysql_query("SELECT * FROM `pit_user` WHERE `id_user` = '$user[id]'"));
//Параметры Противника
$sila = rand(1,$user[sila]*2);
$health = rand(1,$user[health]);
$lovk = rand(1,$user[lovk]);
$zashit = rand(1,$user[zashit]);
$avatar = rand(1,26);
$avatas = rand(1,8);
$silver = rand(10,100);
$exp = rand(($user[param]/310),($user[param]/300));
$health2 = rand(1,$user[lvl]+5);
$gold = rand(0,2);
//Идем дальше
switch($act) {
case 'attack':
if($user['health'] < 50){
$_SESSION['light'] = $warning_coliseum_low_health;
header('Location: ?');
exit();
}
if($user['mana'] < 100){
$_SESSION['light'] = $warning_coliseum_low_mana;
header('Location: ?');
exit();
}else{
$user_param = $user[param] + $pit[uron] + $fin[uron];
$param = $sila + $health + $lovk + $zashit;
require_once H.'core/head.php';
if($param > $user_param){
mysql_query("update `user` set `health` = '".($user['health']-$health2)."',`mana`='".($user['mana']-50)."' where (`id` = '".$user['id']."')");
if($user[duel_rating] > 1){
mysql_query("update `user` set `duel_rating` = '".($user['duel_rating']-$rating)."' where (`id` = '".$user['id']."')");
}
header('Location: ?');
$_SESSION['light'] = "<h2 class='dred' style='font-weight:bold;'><img src='/images/icon/2hit.png' alt=''/> Поражение <img src='/images/icon/2hit.png' alt=''/></h2><div class='separ'></div><img src='/images/icon/2hit.png' alt=''/> $param VS $user_param <img src='/images/icon/2hit.png' alt=''/><div class='separ'></div></span>";
exit();
}else{
mysql_query("update `user` set `exp` = '".($user['exp']+$exp)."',`silver` = '".($user['silver']+$silver)."',`gold` = '".($user['gold']+$gold)."',`health` = '".($user['health']-$health2)."',`mana`='".($user['mana']-100)."',`duel_rating`='".($user['duel_rating']+$rating)."' where (`id` = '".$user['id']."')");
header("Location: ?");
if($user['clan_id'] != 0) {
    mysql_query("INSERT INTO `jr_clan` SET `user_id` = '".$user['id']."', `clan_id` = '".$user['clan_id']."', `exp` = '$exp'");
    mysql_query("UPDATE `clans` SET `exp` = `exp` + $exp, `quest` = `quest` + 1 WHERE `id` = '".$user['clan_id']."'");
}
$_SESSION['light'] = "<h2 class='dgreen' style='font-weight:bold;'><img src='/images/icon/2hit.png' alt=''/> Победа <img src='/images/icon/2hit.png' alt=''/></h2><div class='separ'></div><img src='/images/icon/gold.png' alt=''/> ".$gold." золота <img src='/images/icon/silver.png' alt=''/> ".$silver." серебра <img src='/images/icon/exp.png' alt='exp'/> ".$exp." опыта<div class='separ'></div><img src='/images/icon/2hit.png' alt=''/> $param VS $user_param <img src='/images/icon/2hit.png' alt=''/><div class='separ'></div><span class='dgreen'></span>";
exit();
}
}
break;
case 'nagrada':
if($user[duel_mission] == 0){
if($user[duel_rating] < 500){
$_SESSION['err'] = "Нужно 500 рейтинга!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']+500)."', `duel_mission` = 1 WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `duel_rating` = '".($user['duel_rating']-500)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получали награду!";
header('Location: ?');
exit();
}
break;
default;
echo "<div class='player left'>";
echo "<img src='/style/duel/$avatar.png' width='120' height='160' style=margin-top:0px>";
echo "</div>";
echo "<div class='player left'>";
echo "<a href='?act=attack'><img src='/images/icon/atk.png' style=margin-bottom:-40px;></a>";
echo "</div>";
echo "<div class='player right'>";
echo "<img src='/style/duel/zver/$avatas.jpg' width='120' height='160' style='margin-right:-120px;margin-top:-250px;>";
echo "</div>";
echo "<div class='player left'>";
echo "<a href='?act=attacks'><img src='/images/icon/atk.png' style='margin-right:10px;margin-top:-15px;'></a>";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<ul class='hint'><li>Параметры врага видны только после атаки!</li></ul>";
echo "</div>";
}
//$pit = mysql_fetch_assoc(mysql_query("SELECT * FROM `pit_user` WHERE `id_user` = '$user[id]'"));
//Параметры Противника
$sila = rand(1,$user[sila]*3);
$health = rand(1,$user[health]*2);
$lovk = rand(1,$user[lovk]*2);
$zashit = rand(1,$user[zashit]);
$avatar = rand(1,26);
$avatas = rand(1,8);
$silver = rand(50,100);
$rating = rand(3,50);
$rating2 = 1;
$exps = rand($user[level],$user[level]*10);
$health2 = rand(1,$user[lvl]+5);
$gold = rand(0,3);
//Идем дальше
switch($act) {
case 'attacks':
if($user['health'] < 20){
$_SESSION['light'] = "<span class='dred'>Для нападения нужно <img src='/images/icon/health.png' alt=''/> 20 Здоровья</span><br/>Здоровье восстанавливается со временем или за золото<br><div class='separ'></div><a class='btn' href='/moduls/ckoldun.php?act=ok'><span class='end'><span class='label'>Восстановить <img src='/images/icon/health.png' alt=''/> 100% здоровья</span></span></a><br><span class='grey'>Цена: <img src='/images/icon/gold.png' alt=''/> 200 золота</span>";
header('Location: ?');
exit();
}
if($user['mana'] < 100){
$_SESSION['light'] = "<span class='dred'>Для нападения нужно <img src='/images/icon/mana.png' alt=''/> 100 маны</span><br/>Мана восстанавливается со временем или за золото<br><div class='separ'></div><a class='btn' href='/moduls/ckoldun.php?act=ok'><span class='end'><span class='label'>Восстановить <img src='/images/icon/mana.png' alt=''/> 100% маны</span></span></a><br><span class='grey'>Цена: <img src='/images/icon/gold.png' alt=''/> 200 золота</span>";
header('Location: ?');
exit();
}else{
$user_param = $user[param] + $pit[uron];
$param = $sila + $health + $lovk + $zashit;
require_once H.'core/head.php';
if($param > $user_param){
mysql_query("update `user` set `health` = '".($user['health']-$health2)."',`mana`='".($user['mana']-50)."' where (`id` = '".$user['id']."')");
if($user[duel_rating] > 1){
mysql_query("update `user` set `duel_rating` = '".($user['duel_rating']-$rating)."' where (`id` = '".$user['id']."')");
}
header('Location: ?');
$_SESSION['light'] = "<h2 class='dred' style='font-weight:bold;'><img src='/images/icon/2hit.png' alt=''/> Поражение <img src='/images/icon/2hit.png' alt=''/></h2><div class='separ'></div><img src='/images/icon/2hit.png' alt=''/> $param VS $user_param <img src='/images/icon/2hit.png' alt=''/><div class='separ'></div><span class='dred'>Рейтинг - $rating</span>";
exit();
}else{
mysql_query("update `user` set `exp` = '".($user['exp']+$exp)."',`silver` = '".($user['silver']+$silver)."',`gold` = '".($user['gold']+$gold)."',`health` = '".($user['health']-$health2)."',`mana`='".($user['mana']-100)."',`duel_rating`='".($user['duel_rating']+$rating)."' where (`id` = '".$user['id']."')");
header("Location: ?");
if($user['clan_id'] != 0) {
    mysql_query("INSERT INTO `jr_clan` SET `user_id` = '".$user['id']."', `clan_id` = '".$user['clan_id']."', `exp` = '$exp'");
    mysql_query("UPDATE `clans` SET `exp` = `exp` + $exp, `quest` = `quest` + 1 WHERE `id` = '".$user['clan_id']."'");
}
$_SESSION['light'] = "<h2 class='dgreen' style='font-weight:bold;'><img src='/images/icon/2hit.png' alt=''/> Победа <img src='/images/icon/2hit.png' alt=''/></h2><div class='separ'></div><img src='/images/icon/gold.png' alt=''/> ".$gold." золота <img src='/images/icon/silver.png' alt=''/> ".$silver." серебра <img src='/images/icon/exp.png' alt='exp'/> ".$exp." опыта<div class='separ'></div><img src='/images/icon/2hit.png' alt=''/> $param VS $user_param <img src='/images/icon/2hit.png' alt=''/><div class='separ'></div><span class='dgreen'>Рейтинг + $rating</span>";
exit();
}
}
break;
default;

}
require_once 'core/foot.php';
?>