Вход Регистрация
Файл: pages/combat/hunting.php
Строк: 160
<?php
// Physical module map v50.6: public URL stays clean while code lives in /pages.
if (!defined('GAME_ROOT')) define('GAME_ROOT'dirname(__DIR__2));
chdir(GAME_ROOT);
if (
PHP_SAPI !== 'cli') { $_SERVER['PHP_SELF']='/hunting.php'$_SERVER['SCRIPT_NAME']='/hunting.php'; }

/* Обновление игры под PHP 8.4 / PDO и усиление безопасности: by Метриум (Стэлп) */
include './system/common.php'
include 
'./system/functions.php';
include 
'./system/user.php';
    
if(!
$user) {
header('location: /');   
exit;
}


$title 'Охота';    
include 
'./system/h.php';



function 
padeg($number,$one,$two,$five)
{
    if(
$number == OR $number%10 == 1){
    return 
$number.' '.$one;}
    elseif((
$number AND $number 5) OR ($number%10 >= AND $number%10 5)){
    return 
$number.' '.$two;
    }else{
    return 
$number.' '.$five;}
}

///////
$name = array('крке','Страж','Полководец','Горен','Странница','Незнакомка','Оборотень','Грейм','Единорог тьмы');
$images = array('',1,2,3,4,5,6,7,8);
$kar rand(1,8);

//////
switch($user['hunt_level']) {

case 
1:$exp_level 100;break;
case 
2:$exp_level 1000;break;
case 
3:$exp_level 5000;break;
case 
4:$exp_level 10000;break;
case 
5:$exp_level 50000;break;
case 
6:$exp_level 100000;break;
case 
7:$exp_level 250000;break;
case 
8:$exp_level 500000;break;
case 
9:$exp_level 1000000;break;
case 
10:$exp_level 5000000;break;
case 
11:$exp_level 10000000;break;
case 
12:$exp_level 50000000;break;
case 
13:$exp_level 100000000;break;
case 
14:$exp_level 500000000;break;
case 
15:$exp_level 1000000000;break;
case 
16:$exp_level 5000000000;break;
case 
17:$exp_level 10000000000;break;
case 
18:$exp_level 50000000000;break;
case 
19:$exp_level 100000000000;break;
case 
20:$exp_level 500000000000;break;
}
//$mob = db_fetch_assoc(db_query("SELECT * FROM `hunt_mobs` ORDER BY RAND() LIMIT 1"));
//$my_hunt_level = db_fetch_assoc(db_query("SELECT * FROM `hunt_level` WHERE `level` = '".$user['hunt_level']."'"));
$width_hunt_exp round($user['hunt_exp']/$exp_level*100); 
if(
$width_hunt_exp >= '100'){ ($width_hunt_exp='100');}
    

if(
$user['hunt_exp'] >= $exp_level){
db_query("UPDATE `users` SET `hunt_level` = `hunt_level` + '1', `hunt_exp` = '0', `hunt_battles` = `hunt_battles` + '1', `hunt_battles_max` = `hunt_battles_max` + '1' WHERE `id` = '".$user['id']."' ");    
}


 if((
$_GET['attack'] ?? null) === 'true' || ($_GET['attack'] ?? null) === true) { 
    
$rand rand(1,5);
    if(
$user['hunt_battles'] > 0)
    {
        if(
$rand != 3)
        {
//Если победа
            
$exp rand((500*$user['hunt_level']),(500*$user['hunt_level']*2));
            
$crystals rand((50*$user['hunt_level']),(50*$user['hunt_level']*2));
if(
$clan){             
db_query("UPDATE `clan_memb` SET `exp` = `exp` + '".$exp."' WHERE `user` = '".$user['id']."'' LIMIT 1");                     
db_query("UPDATE `clans` SET `exp` = `exp` + '".$exp."' WHERE `id` = '".$clan['id']."' LIMIT 1");                
}
db_query("UPDATE `users` SET `hunt_last_update` = '".time()."', `exp` = `exp` + '".$exp."', `hunt_exp` = `hunt_exp` + '".$exp."', `s` = `s` + '".$crystals."', `hunt_battles` = `hunt_battles` - '1' WHERE `id` = '".$user['id']."'");
echo 
'<div class = "opisanie"><center><font color="lime">Победa</font><br/> 
Награда: <img src = "/images/icon/exp.png" width="15" style="border-radius:0px"> '
.$exp.'  и  <img src = "/images/icon/silver.png" width="15" style="border-radius:0px"> '.$crystals.' </center></div>';

        }else{
//Если поражение 

$exp rand((10*$user['hunt_level']),(10*$user['hunt_level'])); 
$crystals rand((15*$user['hunt_level']),(20*$user['hunt_level'])); 
if(
$clan){ 
db_query("UPDATE `clan_memb` SET `exp` = `exp` +'".$exp."' WHERE `user` = '".$clan['id']."' LIMIT 1"); 
db_query("UPDATE `clans` SET `exp` = `exp` + '".$exp."' WHERE `id` = '".$clan['id']."' LIMIT 1"); 

db_query("UPDATE `users` SET `hunt_last_update` = '".time()."', `exp` = `exp` + '".$exp."', `hunt_exp` = `hunt_exp` + '".$exp."', `s` = `s` + '".$crystals."', `hunt_battles` = `hunt_battles` - '1' WHERE `id` = '".$user['id']."'");    
echo 
'<div class = "opisanie"><center><font color="red">Поражение</font><br/> 
Награда: <img src = "/images/icon/exp.png" width="15" style="border-radius:0px"> '
.$exp.'  и <img src = "/images/icon/silver.png" width="15" style="border-radius:0px"> '.$crystals.' </center></div>';            
        }
} else{
//Если нет боев
echo '<center>Нет боёв</center>';
}

}



echo
'
     

<div class="title"><center><font size="3">Охота('
.padeg($user['hunt_battles'],'бой','боя','боёв').')</font></center></div>
<div class="box"><center><a  href="?attack=true" class="btns _g"><span class="end"><span class="label">Напасть</a></center></div>'
;
    
    
    
    if(
$user['hunt_battles'] > 0)
    {
        
echo
'<div class="box">
</a>
<p>
<table  width="80%" cellpadding="0" cellspacing="0">
<tr><td rowspan="2" width="40%">
<img src="/images/mobs/'
.$images[$kar].'.png">
</td>
<td>
<div class = "mob-name"><b>'
.$name[$kar].'</b></div>
</td>
</tr>
<td>
                Сила: <span class="high">'
.($user['str']+rand(1,10)).'</span><br>
                Здоровье: <span class="high">'
.((int)($user['max_health'] ?? ((int)$user['vit']*2))+rand(1,10)).'</span><br>
                Броня: <span class="high">'
.($user['def']+rand(1,10)).'</span>
                </td>
<div class="line"></div>
<div class="main">
<div class="menuList">
</div>
'
;
}else{
echo
' <div class="box">Все бои истрачены! До восстановления: '._time($user['hunt_last_update'] + (60 60 2) - time()).'</div>';
   
    }
      
echo
'<div class="resources">Навык охотника повышается за каждую охоту. Навык повышает шанс встретить необычного врага.</div>';


echo 
'<div class = "box"><table  width="100%" cellpadding="5" cellspacing="0">
<tr><td rowspan="2" width="0%">'
;
//echo"<img src='/images/starec.jpg' style='border-radius:0px'>";
echo'</td>
<td>'
;
echo
'<font color = "orange"><b>'.$user['login'].'</b>, твой навык охотника '.$user['hunt_level'].' уровня</br>Что бы получать новые уровни, нападай на монстров</br>Каждый новый уровень вы получаете больше опыта</font>
</td>
</tr>
<tr>
<div class="hr_g mb2"><div><div></div></div></div>
    <table class="small yell h25 bgc_prg"><tr>
        <td class="va_m plr10 nwr"><img src="/images/icon/level.png" class="va_t" height="16" width="16" alt=""/>'
.$user['hunt_level'].' ур.</td>
        <td class="va_m w100"><div class="prg-bar"><div class="prg-blue" style="width:'
.$width_hunt_exp.'%"></div></div></td>
        <td class="va_m plr10">'
.$width_hunt_exp.'%</td>
    </tr></table>'
;
include 
'./system/f.php';
?>
Онлайн: 3
Реклама