Файл: waphero.ru/duel.php
Строк: 141
<?
require_once 'core/system.php';
echo only_reg();
$header = 'Дуэли';
require_once 'core/head.php';
//Параметры Противника
$sila = rand(1,$user[sila]*2);
$health = rand(1,$user[health]*2);
$lovk = rand(1,$user[lovk]*2);
$zashit = rand(1,$user[zashit]*2);
$avatar = rand(1,5);
$silver = rand(1,100);
$rating = rand(1,100);
$rating2 = 1;
$exp = rand($user[level],$user[level]*2);
$health2 = rand(1,$user[lvl]+5);
//Идем дальше
switch($act) {
case 'attack':
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=''/> 10 золота</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=''/> 10 золота</span>";
header('Location: ?');
exit();
}else{
$user_param = $user[sila] + $user[health] + $user[lovk] + $user[zashit];
$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']-100)."' where (`id` = '".$user['id']."')");
if($user[duel_rating] > 1){
mysql_query("update `user` set `duel_rating` = '".($user['duel_rating']-$rating)."', `arenaweek` = '".($user['arenaweek']-$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)."',`health` = '".($user['health']-$health2)."',`mana`='".($user['mana']-100)."',`duel_rating`='".($user['duel_rating']+$rating)."', `arenaweek` = '".($user['arenaweek']+$rating)."' where (`id` = '".$user['id']."')");
header("Location: ?");
$_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/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;
case 'nagrada':
if($user[duel_mission] == 0){
if($user[duel_rating] < 1000){
$_SESSION['err'] = "Нужно 1000 рейтинга!";
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']-1000)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получали награду!";
header('Location: ?');
exit();
}
break;
default;
echo "<div class='player center'>";
echo "<img src='/style/duel/$avatar.png' width='120' height='160'>";
echo "</div>";
echo "<div class='player center'>";
echo "<a href='?act=attack'><img src='/images/icon/atk.png'></a>";
echo "</div>";
if($user[duel_mission] == 0){
echo "<div class='dot-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Лучший боец:</b><br/><span class='medium'>Набери 1000 рейтинга и получи 500 золота!<br/><span class='blue'>Прогресс:</span> $user[duel_rating] из 1000";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(1000/($user[duel_rating]+1)))."%'></div>";
echo "</div>";
echo "<a class='btn' href='?act=nagrada'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
}
echo "<div class='mini-line'></div>";
echo "<ul class='hint'><li>Параметры врага видны только после атаки!</li></ul>";
}
echo'<div class="player menuList">
<li>
<a href="/toparena.php">Топ недели</a></li></div>';
require_once 'core/foot.php';
?>