Вход Регистрация
Файл: public_html/modules/demons/players.php
Строк: 175
<?php
$root 
$_SERVER['DOCUMENT_ROOT'];
include_once (
$root.'/core/base.php');
falseauth();
$header "Вторжение демонов";
include_once (
$root.'/core/head.php');
?>
<style>
.example3 .examples_text-1 {
    display: block;
    position: absolute;
    font-size: 20px;
    left: 0;
    bottom: 120px;
    width: 100%;
    height: 10%;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #fff;
    padding: 0px;
}
.example3 {
    display: inline-block;
    position: relative;
    width: 100%;
}
.example3 .examples_text-9 {
    display: block;
    position: absolute;
    font-size: 45px;
    left: 0;
    bottom: 255px;
    width: 100%;
    height: 3%;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #fff;
}
</style>
<?
$btl 
$db->query("SELECT * FROM `demons_battles` WHERE `status` = 'battle' ORDER BY `id` DESC LIMIT 1");
if(
$btl->num_rows == 0redirect('/demons');
$btl $btl->fetch_object();
if(
$btl->stage == 'boss'redirect('/demons/boss');
if(
$btl->stage == 'mobs'redirect('/demons/mobs');
$myPlayer $db->query("SELECT * FROM `demons_players` WHERE `user` = '".$u['id']."' AND `battle` = '".$btl->id."'");
if(
$myPlayer->num_rows == 0redirect('/demons');
$myPlayer $myPlayer->fetch_object();
$players $db->query("SELECT * FROM `demons_players` WHERE `battle` = '".$btl->id."'")->num_rows;
$alivePlayers $db->query("SELECT * FROM `demons_players` WHERE `battle` = '".$btl->id."' AND `health` > '0'")->num_rows;
if(
$alivePlayers == 1)
{
    
$db->query("UPDATE `demons_battles` SET `status` = 'result-win' WHERE `id` = '".$btl->id."'");
    
redirect('/demons/result');
}
if(
$myPlayer->opponent == 0)
{
    
$randOpponent $db->query("SELECT * FROM `demons_players` WHERE `battle` = '".$btl->id."' AND `user` != '".$u['id']."' AND `health` > '0' ORDER BY RAND() LIMIT 1")->fetch_object();
    
$db->query("UPDATE `demons_players` SET `opponent` = '".$randOpponent->id."' WHERE `id` = '".$myPlayer->id."'");
    
redirect('/demons/players');
}
$opponent $db->query("SELECT * FROM `demons_players` WHERE `id` = '".$myPlayer->opponent."'")->fetch_object();
if(
$opponent->health <= 0)
{
    
$db->query("UPDATE `demons_players` SET `opponent` = '0' WHERE `id` = '".$myPlayer->id."'");
    
redirect('/demons/players');
}
if(isset(
$_GET['attack']))
{
    if(
$myPlayer->health <= 0redirect('/demons/players');
    
$damage getDamage(get_power($u['id']), get_block($opponent->user));
    
$cooldown_time $myPlayer->attack_cd-time();
    if(
$cooldown_time >= 2$finalDamage 0;
    elseif(
$cooldown_time == && $cooldown_time == 1$finalDamage round($damage*(rand(1,50)/100));
    else 
$finalDamage $damage;
    if(
$finalDamage != 0$db->query("UPDATE `demons_players` SET `attack_cd` = '".(time()+3)."', `damage` = `damage` + '".$finalDamage."' WHERE `id` = '".$myPlayer->id."'");
    
$db->query("UPDATE `demons_players` SET `health` = `health` - '".$finalDamage."' WHERE `id` = '".$opponent->id."'");
    if(
$finalDamage == 0$logMsg name($u['id']).' промахнулся по '.name($opponent->user).'.';
    else
    {
        if(
$finalDamage >= $opponent->health)
        {
            
$db->query("UPDATE `demons_players` SET `deathtime` = '".time()."' WHERE `id` = '".$opponent->id."'");
            
$logMsg name($u['id']).' убил '.name($opponent->user).'.';
        }
        else 
$logMsg name($u['id']).' ударил '.name($opponent->user).' на '.$finalDamage.'.';
    }
    
$db->query("INSERT INTO `battle_logs` (`type`,`battle`,`msg`,`time`) VALUES ('demons-players', '".$btl->id."', '".$logMsg."', '".time()."')");
    
redirect('/demons/players');
}
if(isset(
$_GET['heal']))
{
    if(
$myPlayer->health <= 0redirect('/demons/players');
    if(
$myPlayer->heal_cd time()) redirect('/demons/players');
    if(
$myPlayer->health >= get_health($u['id'])) redirect('/demons/players');
    
$healBonus getSkillBonus('heal');
    if(
$healBonus+$myPlayer->health get_health($u['id'])) $hp get_health($u['id']);
    else 
$hp $myPlayer->health+$healBonus;
    
$db->query("UPDATE `demons_players` SET `health` = '".$hp."', `heal_cd` = '".(time()+30)."' WHERE `id` = '".$myPlayer->id."'");
    
redirect('/demons/players');
}
if(isset(
$_GET['arrow']))
{
    if(
$myPlayer->health <= 0redirect('/demons/players');
    
$damage getDamage(getSkillBonus('arrow'), get_block($opponent->user));
    if(
$myPlayer->arrow_cd time()) redirect('/demons/players');
    
$finalDamage $damage;
    
$db->query("UPDATE `demons_players` SET `arrow_cd` = '".(time()+40)."', `damage` = `damage` + '".$finalDamage."' WHERE `id` = '".$myPlayer->id."'");
    
$db->query("UPDATE `demons_players` SET `health` = `health` - '".$finalDamage."' WHERE `id` = '".$opponent->id."'");
    if(
$finalDamage >= $opponent->health)
    {
        
$logMsg name($u['id']).' убил '.name($opponent->user).' навыком "Разряд".';
        
$db->query("UPDATE `demons_players` SET `deathtime` = '".time()."' WHERE `id` = '".$opponent->id."'");
    }
    else 
$logMsg name($u['id']).' ударил '.name($opponent->user).' навыком "Разряд" на '.$finalDamage.'.';
    
$db->query("INSERT INTO `battle_logs` (`type`,`battle`,`msg`,`time`) VALUES ('demons-players', '".$btl->id."', '" .$logMsg."', '".time()."')");
    
redirect('/demons/players');
}
echo 
'<div class="example3">
    
            <div class="b">
            <div class="examples_text-9"><center>'
.$alivePlayers.'</center></div>
                <div class="examples_text-1">
        
                    <center>
                            
                            <a href="?attack"><img src="/images/b-ok.png" width="17%"></a>
                    </center>
            
            </div>
            
<center>

    <b><big>
            
            Игрок <img src="/images/health.png" width="35" height="30"> '
.$opponent->health.'
    </b></big>
</center>

    <center><img src="/modules/demons/user-min.png" width="50%"></center>
    
    <br></br></div>'
;
    
        
                
                    echo 
'<div class="b-mini"><center>
                    
                                <font color = "lime"><b><big><img src="/images/users.png" width="35px"> Вы
                                        
                                        <img src="/images/health.png" width="35" height="30">
                                        
            '
.$myPlayer->health.'              </font>  
            
            </b></big></center>
                
       <div style="height: 8px; border: 1px solid #000; position:relative; border-radius: 4px">
                                        <div style="height: 8px; background: #00A4D9; width:56%; position: absolute; left: 0px; top: 0px; border-radius: 2px; border-bottom-right-radius: 1px;border-top-right-radius: 1px;">
                                        </div>
                                    </div>
        </div>
                                        '
;
                                        echo
'<div class = "b-mini">';
                                        echo
'
    <table style="width:100%;">
    
            <tr>
            
                    <td style="width: 33%;" class="center">'
;
                    
if(
$myPlayer->heal_cd time())
{
    echo
'
    <input type="submit" value="Исцеление ('
.tl($myPlayer->heal_cd-time()).')">
    </td>'
;
}
else
{
    echo 
'<a href="?heal"><input type="submit" value="Исцеление"></a>
    </td>'
;
}
    echo
'
    <td style="width:33%;" class="center">'
;
    if(
$myPlayer->arrow_cd time())
{
    echo 
'<input type="submit" value="Разряд ('.tl($myPlayer->arrow_cd-time()).')">
    </td>
    </tr>
    </table>
    '
;
}
else
{
    echo 
'<a href="?arrow"><input type="submit" value="Разряд"></a>
    </td>
    </tr>
    </table>
    '
;
}
    echo
'</td>
    </tr>
    </table>'
;
echo 
'</div></div>
'
;
$log $db->query("SELECT * FROM `battle_logs` WHERE `type` = 'demons-players' AND `battle` = '".$btl->id."' ORDER BY `time` DESC LIMIT 10");
if(
$log->num_rows 0)
{
    echo 
'<div class="b">';
    while(
$l $log->fetch_object())
    {
        echo 
$l->msg.'<br>';
    }
    echo 
'</div>';
}
include_once (
$root.'/core/foot.php');
Онлайн: 0
Реклама