Вход Регистрация
Файл: weatut.ru/arena.php
Строк: 333
<?php
require_once ('system/func.php');
$title 'Арена';
require_once (
'system/header.php');
auth(); // Закроем от гостей
$batle mysql_query("SELECT * FROM `arena` WHERE `id_user` = '".$myID."' ORDER BY `id` LIMIT 1");
$batle mysql_fetch_array($batle);
if(!
$batle){
mysql_query("INSERT INTO `arena` SET `id_user` = '$user[id]', `last` = '".time()."'");
header('Location: /arena');
exit();
}











if(isset(
$_GET['max_energy']) == true and $batle['last'] <= time()){
$id num($_GET['max_energy']);
$_hp ceil($user['max_health']*10/100);
if(
$user['energy'] < 10 or $user['gold'] < or $user['health'] < $_hp){
$_SESSION['msg'] = "Для нападения необходимо минимум ".ico('icons','health.png')." 10% жизни, ".ico('icons','energy.png')." 10 энергии!<br><a href='/rinok?koldun&url=/arena' class='btn2' data-ajax>Восстановить ".ico('icons','gold.png')." 15</a>";
header('Location: /arena?'.$random.'');
exit();
}else{








$koll num($user['energy']/10);
$exp 0;
$crystals 0;
$win 0;
$los 0;
for(
$kolls 1$kolls <= $koll$kolls++) {
$opponent mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
$_str 0;
$_str_opp 0;
for(
$round 1$round num($user[energy]/10); $round++) {

## Это раз ##

$_str_1 rand(round($user['str']/6), round($user['str']/4));
$_str_opp_1 rand(round($opponent['str']/6), round($opponent['str']/4));
$_str_opp_1 -= rand(round($user['def']/12), round($user['def']/7));
$_str_1 -= rand(round($opponent['def']/12), round($opponent['def']/7));

if(
$_str_opp_1 0)$_str_opp_1 1;
if(
$_str_1 0)$_str_1 1;

## Это 2 ##

$_str += $_str_1;

$_str_opp += $_str_opp_1;

}
if(
$_str_1 $_str_opp_1){
$exp += num(rand(1,3)*$opponent[level]);
$crystals += num(rand(3,5)*$opponent[level]);
$win += 1;
}else{
$exp += 1;
$crystals += 1;
$los += 1;
}
}
if(
$effect_2['on'] == 1)$exp $exp+ceil($exp*25/100);
$exp exp_koll($exp);
mysql_query("update `users` set
`exp` = '"
.($user['exp']+$exp)."',
`crystals` = '"
.($user['crystals']+$crystals)."',
`health` = '"
.($user['health']-$_str_opp)."',
`energy` = '"
.($user['energy']-$koll*10)."',
`gold` = '"
.($user['gold']-1)."'
where (`id` = '"
.$user['id']."')");
if(
$user[id_clan] > 0){
mysql_query("UPDATE `users` SET `clan_exp` = '".($user[clan_exp]+ceil($exp*15/100))."' WHERE `id` = '".$myID."' LIMIT 1");
mysql_query("UPDATE `clans` SET `exp` = `exp` + '".ceil($exp*15/100)."' WHERE `id` = '".$user[id_clan]."' LIMIT 1");
}
mysql_query("update `arena` set `last` = '".(time()+2)."' where (`id` = '".$batle['id']."')");
$_SESSION['msg'] = ico('icons','sum_stat.png')." <b class='info'>Проведено $round боев</b> ".ico('icons','sum_stat.png')."<hr>
<font color='green'>Побед: <b>
$win</b></font> | <font color='red'>Поражений: <b>$los</b></font><hr>
Награда: "
.ico('icons','exp.png')." ".n_f($exp)." опыта и ".ico('icons','crystal.png')." ".n_f($crystals)." кристаллов<hr>
<div class='example3' style='text-align:center'><img src='images/other/koldun.png' class='example_beauty';border-radius:8px'> <br/>
Здравствуй <b><font color='
$user[color]'>$myLogin</font></b> я могу восстановить тебе ".ico('icons','health.png')." 100% жизни и ".ico('icons','energy.png')." энергии.
<a href='/rinok?koldun&url=/arena?max_energy=
$opponent[id]' class='link center'>Восстановить и провести бои ".ico('icons','gold.png')." 16</a></div>";
$_SESSION['itog'] = icons_user($myID)."
<a><font color='
$user[color]'>$user[login]</font></a> нанес $_str урона<br>".icons_user($opponent[id])." <a>
<font color='
$opponent[color]'>$opponent[login]</font></a> нанес $_str_opp урона
"
;
header('Location: /arena?'.$random.'');
exit();
}
}
if(isset(
$_GET['attack']) == true and $batle['last'] <= time()){
$id num($_GET['attack']);
$_hp ceil($user['max_health']*10/100);
if(
$user['energy'] < 10 or $user['health'] < $_hp){
$_SESSION['msg'] = "Для нападения необходимо минимум ".ico('icons','health.png')." 10% жизни и ".ico('icons','energy.png')." 10 энергии!<br><a href='/rinok?koldun&url=/arena' class='btn2' data-ajax>Восстановить ".ico('icons','gold.png')." 15</a>";
header('Location: /arena');
exit();
}
else{

$inv mysql_result(mysql_query("SELECT COUNT(*) FROM `inv` WHERE `odeta` = 'net' AND `id_user` = '$myID'"),0);
if(
$inv 20){
if(
mt_rand(1,40) >= '35'){
$item mysql_fetch_assoc(mysql_query("SELECT * FROM `item` WHERE `skill` <= '".$user['skill']."' ORDER BY RAND() "));
mysql_query("INSERT INTO `inv` SET `id_user` = '".($user['id'])."', `name` = '$item[name]', `str` = '$item[str]', `def` = '$item[def]', `health` = '$item[health]', `tip` = '$item[tip]', `skill` = '$item[skill]', `odeta` = 'net' , `item` = '$item[item]'")or die(mysql_error());
$award "
<div style = 'text-align:center;'>
<font color=#bce4f4>Новая вещь в твоей сумке</font><br>
<font color=#bce4f4>
$item[name]</font><br>
<img src='/images/items/
$item[tip]/$item[item].png'>
<br>
</div>
"
;
logi($award);
}
}



mysql_query("update `users` set `energy` = '".($user['energy']-10)."' where (`id` = '".$user['id']."')");
mysql_query("update `arena` set `last` = '".(time()+2)."' where (`id` = '".$batle['id']."')");
$opponent mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
$schet 0;
$schet_opp 0;
$_str_opp rand(round($opponent['str']/6), round($opponent['str']/4));
$_def_opp rand(round($opponent['def']/12), round($opponent['def']/7));
$_str_opp $_str_opp $_def;
if(
$_str_opp 0)$_str_opp 1;
$_str $_str $_def_opp;
if(
$_str 0)$_str 0;
if(
$_str $_str_opp){
$schet $schet 1;
}elseif(
$_str_opp $_str){
$schet_opp $schet_opp 1;
}
else{
$schet $schet 1;
$schet_opp $schet_opp 1;
}
if(
$schet >= $schet_opp){
$exp exp_koll(num(rand(1,3)*$opponent[level]));
if(
$effect_2['on'] == 1)$exp $exp+ceil($exp*25/100);
$crystals num(rand(3,5)*$opponent[level]);

$_str_opp round(($_str/100) * mt_rand(50,80));
mysql_query("update `users` set `exp` = '".($user['exp']+$exp)."', `crystals` = '".($user['crystals']+$crystals)."', `health` = '".($user['health']-$_str_opp)."' where (`id` = '".$user['id']."')");
if(
$user[id_clan] > 0){
mysql_query("UPDATE `users` SET `clan_exp` = '".($user[clan_exp]+ceil($exp*15/100))."' WHERE `id` = '".$myID."' LIMIT 1");
mysql_query("UPDATE `clans` SET `exp` = `exp` + '".ceil($exp*15/100)."' WHERE `id` = '".$user[id_clan]."' LIMIT 1");
}
$_SESSION['msg'] = "<font color='green'><b>Победа</b></font><br>Опыт ".ico('icons','exp.png').$exp,Кристаллы ".ico('icons','crystal.png').$crystals";
$_SESSION['itog'] = icons_user($myID)."
<a>
$user[login]</a> нанес $_str урона<br>".icons_user($opponent[id])."
<a>
$opponent[login]</a> нанес $_str_opp урона
"
;
header('Location: /arena?'.$random.'');
exit();
}
else{
$exp exp_koll(1);
if(
$effect_2['on'] == 1)$exp $exp+ceil($exp*25/100);
mysql_query("update `users` set `exp` = '".($user['exp']+$exp)."', `crystals` = '".($user['crystals']+1)."', `health` = '".($user['health']-$_str_opp)."' where (`id` = '".$user['id']."')");
if(
$user[id_clan] > 0){
mysql_query("UPDATE `users` SET `clan_exp` = '".($user[clan_exp]+ceil($exp*15/100))."' WHERE `id` = '".$myID."' LIMIT 1");
mysql_query("UPDATE `clans` SET `exp` = `exp` + '".ceil($exp*15/100)."' WHERE `id` = '".$user[id_clan]."' LIMIT 1");
}
$_SESSION['msg'] = "<font color='red'><b>Поражение</b></font><hr><a href='/arena/$opponent[id]/' class='btn2'>Сразиться</a><hr>Награда: ".ico('icons','exp.png').$exp опыта и ".ico('icons','crystal.png')." 1 кристаллов<hr><a href='/arena?max_energy=$opponent[id]' class='btn2'>Максимум энергии ".ico('icons','gold.png')." 1</a>";
$_SESSION['itog'] = icons_user($myID)." <a>$user[login]</a> нанес $_str урона<br>".icons_user($opponent[id])." <a>$opponent[login]</a> нанес $_str_opp урона";
header('Location: /arena?'.$random.'');
exit();
}
}
}
$opponent mysql_query("SELECT * FROM `users` WHERE `side` != '$user[side]'  AND `str`+`def`+`max_health` >= '".ceil($user[str]+$user[def]+$user[max_health]*40/100)."' AND `str`+`def`+`max_health` <= '".ceil($user[str]+$user[def]+$user[max_health]*70/100)."' ORDER BY RAND() LIMIT 1");
$opponent mysql_fetch_array($opponent);
if(!
$opponent){
$opponent mysql_query("SELECT * FROM `users` WHERE `side` != '$user[side]'  AND `str`+`def`+`max_health` <= '".($user[str]+$user[def]+$user[max_health])."' ORDER BY RAND() LIMIT 1");
$opponent mysql_fetch_array($opponent);
}
echo 
'<div class="ribbon mb2"><div class="rl"><div class="rr">
            Арена </div></div></div>'
;
echo 
'<div class="bdr bg_main mb2"><div class="light"><div class="wr1"><div class="wr2"><div class="wr3"><div class="wr4"><div class="wr5"><div class="wr6"><div class="wr7"><div class="wr8">';
echo 
logs();
echo 
"<div class='oh'><a href='/arena/$opponent[id]/' data-ajax><img src='/manekenImage_$opponent[id].png' width='110px' style='margin-right:3px;margin-top:-2px;'></a></div>".icons_user($opponent[id])." <a><font color='$opponent[color]'>$opponent[login]</font></a><br><br>";
echo 
ico('icons','str.png')."<font color='#eacc54'> Атака: $opponent[str]</font><br>".ico('icons','def.png')."<font color='#eacc54'> Защита: $opponent[def]</font><br> ".ico('icons','health.png')."<font color='#eacc54'> Жизнь: $opponent[max_health]</font><br><br>";
echo 
"<a href='/arena/$opponent[id]/' class='btn2' data-ajax>Атаковать</a>";
echo 
"<div style='clear:both;'></div>";
echo 
"<hr><center><a href='/arena?max_energy=$opponent[id]/' class='ibtn w90px mt5 mb5' data-ajax>Авто-Бой за ".ico('icons','gold.png')." 1</a><center><br>";
echo 
'</div></div></div></div></div></div></div></div></div></div>';
echo 
'<div class="hr_g mb2"><div><div></div></div></div>';
echo 
'<div class="bntf"><div class="small"><div class="nl"><div class="nr cntr lyell small lh1 plr15 pt5 pb5 sh">
        Чем выше уровень амулета, тем больше шанс победить и получить больше опыта!    </div></div></div></div>'
;
echo 
'<div class="hr_g mb2"><div><div></div></div></div>';
echo 
'<div class="bntf"><div class="small"><div class="nl"><div class="nr cntr lyell small lh1 plr15 pt5 pb5 sh">
<a href="/amulet" class="lwhite nd"><img src="http://144.76.127.94/view/image/arena/amulet1.png" height="16" class="icon"> Амулет (+)</a></div><div></div>'
;
if(isset(
$_SESSION['itog'])){

unset(
$_SESSION['itog']);
}
require_once (
'system/footer.php');
?>
Онлайн: 1
Реклама