Вход Регистрация
Файл: weatut.ru/ten.php
Строк: 58
<?php
require_once ('system/func.php');
$title 'Тень';
require_once (
'system/header.php');
auth(); // Закроем от гостей
if(vremja() >= '07:00:00' and vremja() <= '19:00:00'){
$ten['status'] = 1;
}else{
$ten['status'] = 0;
}
if(
$ten['status'] == 1){
# Атака #
if(isset($_GET['attack'])){
if(
$user['gold'] < 5){
$_SESSION['msg'] = 'Не хватает '.ico('icons','gold.png').' '.(5-$user['gold']).' золота';
header("Location: ?");
exit();
}
$_hp ceil($user['max_health']*10/100);
if(
$user['health'] < $_hp){
$_SESSION['msg'] = "Для нападения необходимо минимум ".ico('icons','health.png')." 10% жизни.<br><a href='/rinok?koldun&url=/ten/?$random' class='btn2' data-ajax>Восстановить ".ico('icons','gold.png')." 15</a>";
header('Location: ?');
exit();
}else{
mysql_query("update `users` set 
`gold` = '"
.($user['gold']-5)."'
where (`id` = '"
.$user['id']."')");
# Статы тени #
$batle_str ceil($user['str']*110/100);
$batle_def ceil($user['def']*110/100);
# Урон #
$schet 0;
$schet_opp 0;
$_str_opp rand(round($batle_str/6), round($batle_str/4));
$_def_opp rand(round($batle_def/12), round($batle_def/7));
$_str_opp $_str_opp $_def;
if(
$_str_opp 0)$_str_opp 0;
$_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;
}
$gold rand(5,20);
$crystals rand(1000,5000);
if(
$schet $schet_opp){
mysql_query("update `users` set 
`gold` = '"
.($user['gold']+$gold)."', `health` = '".($user['health']-$_str_opp)."' 
where (`id` = '"
.$user['id']."')");
$_SESSION['msg'] = "<font color='green'><b>Победа</b></font><hr>Награда: ".ico('icons','gold.png').$gold золота";
}else{
mysql_query("update `users` set 
`crystals` = '"
.($user['crystals']+$crystals)."', `health` = '".($user['health']-$_str_opp)."' 
where (`id` = '"
.$user['id']."')");
$_SESSION['msg'] = "<font color='red'><b>Поражение</b></font><hr>Награда: ".ico('icons','crystal.png').$crystals кристаллов";
}
header("Location: ?");
exit();
}
}
echo 
"<h1>Собственная тень</h1>";
echo 
"<div class='block center'>";
echo 
"<img src='/manekenImage_$myID.png'><hr>";
echo 
ico('icons','str.png')." Атака: ".ceil($user[str]*110/100)."<br>".ico('icons','def.png')." Защита: ".ceil($user[def]*110/100);
echo 
"<hr>";
echo 
"<a href='?attack' class='link center' data-ajax>Атаковать</a>";
echo 
"Стоимость: ".ico('icons','gold.png')." 5 золота<hr>";
echo 
"<ul class='info'>";
echo 
"<small><li>Победив свою тень Вы получите золото</li><li>В случае поражения Вы получите кристаллы</li>";
echo 
"</ul></small>";
}else{
echo 
"<div class='block center'>Тень доступна только в определённое время: <span class='white'>с 07:00 по 19:00</span> по мск времени! Сейчас <span class='white'>".vremja()."</span> мск.</div>";
}
echo 
"</div>";
require_once (
'system/footer.php');
?>
Онлайн: 1
Реклама