Вход Регистрация
Файл: pve.php
Строк: 1002
<?php
include_once ('core/base.php');
falseauth();
$header 'Битва';
include_once (
'core/head.php');

$action fl($_GET['action']);
$_GET['skill'] = fl($_GET['skill']);
$_GET['potion'] = fl($_GET['potion']);

if(!
$uparty$battle $base -> query('SELECT * FROM `pve` WHERE `user` = "'.$u['id'].'" LIMIT 1') -> fetch_assoc();
else 
$battle $base -> query('SELECT * FROM `pve` WHERE `party` = "'.$uparty['id'].'" AND `user` = "'.$u['id'].'" LIMIT 1') -> fetch_assoc();

if(!
$battle){
    
//$_SESSION['message'] = 'Бой не найден...';
    
if($u['battle'] == 'pve'$base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$u['id'].'" LIMIT 1');
    
header('Location: /location/');
    exit;
}else{

$mob $base -> query('SELECT * FROM `mobs` WHERE `id` = "'.$battle['mob'].'" LIMIT 1') -> fetch_assoc();

if(
$uparty){
$first_user $base -> query('SELECT * FROM `users` WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1') -> fetch_assoc();
$second_user $base -> query('SELECT * FROM `users` WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1') -> fetch_assoc();
$third_user $base -> query('SELECT * FROM `users` WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1') -> fetch_assoc();
}

if(
$battle['mob_hp'] <= 0){
    
//Победа
    
$drops $base -> query('SELECT * FROM `drops` WHERE `mob` = "'.$mob['id'].'" ORDER BY RAND()');
    while(
$drop $drops -> fetch_assoc()){
        
$item $base -> query('SELECT * FROM `items` WHERE `id` = "'.$drop['item'].'" LIMIT 1') -> fetch_assoc();
        
$chance $drop['chance'] / 100;
        
//Если выпало
        
if(mt_rand(0.00,100) <= $chance){
            if(
$item['what'] == 'clothing'){
                
$base -> query('INSERT INTO `users_items` SET
                `user` = "'
.$u['id'].'",
                `name` = "'
.$item['name'].'",
                `description` = "'
.$item['description'].'",
                `image` = "'
.$item['image'].'",
                `level` = "'
.$item['level'].'",
                `what` = "'
.$item['what'].'",
                `type` = "'
.$item['type'].'",
                `attack_type` = "'
.$item['attack_type'].'",
                `p_att` = "'
.$item['p_att'].'",
                `m_att` = "'
.$item['m_att'].'",
                `p_def` = "'
.$item['p_def'].'",
                `m_def` = "'
.$item['m_def'].'",
                `endurance` = "'
.$item['endurance'].'",
                `intellect` = "'
.$item['intellect'].'",
                `agility` = "'
.$item['agility'].'",
                `skill` = "'
.$item['skill'].'",
                `max_quality` = "'
.$item['max_quality'].'",
                `set` = "'
.$item['set'].'",
                `mark` = "'
.$item['mark'].'",
                `cost` = "'
.($item['cost'] / 2).'",
                `ident_id` = "'
.$item['id'].'"');
            }else{
                
$old_item $base -> query('SELECT * FROM `users_items` WHERE `user` = "'.$u['id'].'" AND `ident_id` = "'.$item['id'].'" LIMIT 1') -> num_rows;
                if(
$old_item 0){
                    
$base -> query('UPDATE `users_items` SET `amount` = `amount` + "1" WHERE `user` = "'.$u['id'].'" AND `ident_id` = "'.$item['id'].'" LIMIT 1');
                }else{
                    
$base -> query('INSERT INTO `users_items` SET
                    `user` = "'
.$u['id'].'",
                    `name` = "'
.$item['name'].'",
                    `description` = "'
.$item['description'].'",
                    `image` = "'
.$item['image'].'",
                    `what` = "'
.$item['what'].'",
                    `potion` = "'
.$item['potion'].'",
                    `hp_regen` = "'
.$item['hp_regen'].'",
                    `mp_regen` = "'
.$item['mp_regen'].'",
                    `rune_type` = "'
.$item['rune_type'].'",
                    `mark` = "'
.$item['mark'].'",
                    `amount` = "1",
                    `cost` = "'
.($item['cost'] / 2).'",
                    `ident_id` = "'
.$item['id'].'"');
                }
            }
            if(
$item['mark'] == '0'$color 'B1B1B1';
            if(
$item['mark'] == '1'$color '30C030';
            if(
$item['mark'] == '2'$color '68A8F9';
            if(
$item['mark'] == '3'$color 'D8CD32';
            if(
$item['mark'] == '4'$color 'DD4FFF';
            
$drop_text .= '<br/>Получено: <font color="#'.$color.'">'.$item['name'].'</font>';
        }
    }
    if(
$u['vip'] > 0){
        if(
$u['vip'] == 1){
            
$mob['exp'] = $mob['exp'] + ($mob['exp'] / 2);
            
$mob['silver'] = $mob['silver'] + ($mob['silver'] / 2);
        }elseif(
$u['vip'] == 2){
            
$mob['exp'] = $mob['exp'] * 2;
            
$mob['silver'] = $mob['silver'] * 2;
        }elseif(
$u['vip'] == 3){
            
$mob['exp'] = $mob['exp'] * + ($mob['exp'] / 2);
            
$mob['silver'] = $mob['silver'] * + ($mob['silver'] / 2);
        }
    }
    
$mob['exp'] = intval($mob['exp']);
    
$mob['silver'] = intval($mob['silver']);
    if(
$uclan){
        
$clan_exp $mob['exp'] / 2;
        
$base -> query('UPDATE `clans` SET `exp` = `exp` + "'.$clan_exp.'" WHERE `id` = "'.$uclan['id'].'" LIMIT 1');
        
$base -> query('UPDATE `users` SET `clan_exp` = `clan_exp` + "'.$clan_exp.'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
    }
    if(
$uparty['third_user'] != 0){
        
$mob['exp'] = intval($mob['exp'] / 3);
        
$mob['silver'] = intval($mob['silver'] / 3);
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1');
    }elseif(
$uparty['second_user'] != 0){
        
$mob['exp'] = intval($mob['exp'] / 2);
        
$mob['silver'] = intval($mob['silver'] / 2);
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
    }else{
        
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$mob['exp'].'", `silver` = `silver` + "'.$mob['silver'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
    }
    
$quest_q $base -> query('SELECT * FROM `users_quests` WHERE `user` = "'.$u['id'].'" AND `kill_mob_id` = "'.$mob['id'].'" AND `status` = "active"');
    
$quest_nr $quest_q -> num_rows;
    if(
$quest_nr 0){
        
$quest $quest_q -> fetch_assoc();
        
$base -> query('UPDATE `users_quests` SET `mob_already_killed` = `mob_already_killed` + "1" WHERE `user` = "'.$u['id'].'" AND `kill_mob_id` = "'.$mob['id'].'" AND `status` = "active"');
        if((
$quest['mob_already_killed'] + 1) >= $quest['kill_mob_count']) $quest_progress 'Задание выполнено!';
        else 
$quest_progress ''.($quest['mob_already_killed'] + 1).'/'.$quest['kill_mob_count'].'';
        
$quest_mob_kill '<br/>"'.$quest['name'].'": '.$quest_progress.'';
    }
    if(
$u['hp'] <= 0$hp $u['max_hp'] / 4;
    else 
$hp $u['hp'];
    
$base -> query('UPDATE `users` SET `hp` = "'.$hp.'", `kills` = `kills` + "1" WHERE `id` = "'.$u['id'].'" LIMIT 1');
    if(
$event['step'] == 1){ #Событие
        
$token_chance mt_rand(0100);
        if(
$token_chance <= 50){
            
$base -> query('UPDATE `users` SET `token` = `token` + "1" WHERE `id` = "'.$u['id'].'" LIMIT 1');
            
$token_plus ' <img src="/images/icons/'.$event['image'].'_token.png" width="16px">1';
        }
    }
        
$win_msg '<b>Победа!</b> <img src="/images/icons/exp.png" width="16px">'.n_f($mob['exp']).' <img src="/images/icons/silver.png" width="16px">'.n_f($mob['silver']).'
        '
.$token_plus.'
        '
.$drop_text.'
        '
.$quest_mob_kill.'';
        
$win_msg_small '<b>Победа!</b> <img src="/images/icons/exp.png" width="16px">'.n_f($mob['exp']).' <img src="/images/icons/silver.png" width="16px">'.n_f($mob['silver']).'';
    if(!
$uparty){
        
$_SESSION['message'] = $win_msg;
        
$base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$u['id'].'" LIMIT 1');
        
$base -> query('DELETE FROM `pve` WHERE `id` = "'.$battle['id'].'"');
        
$base -> query('DELETE FROM `pve_log` WHERE `pve_id` = "'.$battle['id'].'"');
    }else{
        if(isset(
$first_user) AND $first_user['id'] != $u['id']) $base -> query('UPDATE `users` SET `battle` = "no", `last_log` = "'.$win_msg_small.'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
        if(isset(
$second_user) AND $second_user['id'] != $u['id']) $base -> query('UPDATE `users` SET `battle` = "no", `last_log` = "'.$win_msg_small.'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
        if(isset(
$third_user) AND $third_user['id'] != $u['id']) $base -> query('UPDATE `users` SET `battle` = "no", `last_log` = "'.$win_msg_small.'" WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1');
        
$_SESSION['message'] = $win_msg;
        
$base -> query('DELETE FROM `pve` WHERE `party` = "'.$uparty['id'].'"');
        
$base -> query('DELETE FROM `pve_log` WHERE `party_id` = "'.$uparty['id'].'"');
    }
    unset(
$_SESSION['user_fast_log']);
    unset(
$_SESSION['enemy_fast_log']);
    
//Обучение
    
if($u['training_step'] == 14){
        unset(
$_SESSION['message']);
        
header('Location: /training/next/');
        exit;
    }
    
header('Location: /location/');
    exit;
}
if(
$uparty){
        if(
$first_user['hp'] <= 0){
                
$base -> query('UPDATE `users` SET
                `world` = "'
.$first_user['respawn_world'].'",
                `x` = "'
.$first_user['respawn_x'].'",
                `y` = "'
.$first_user['respawn_y'].'",
                `hp` = "'
.intval($first_user['max_hp'] / 4).'",
                `mp` = "'
.intval($first_user['max_mp'] / 4).'",
                `battle` = "no",
                `last_log` = "Поражение..."
                WHERE `id` = "'
.$first_user['id'].'" LIMIT 1');
                if(
$uparty['second_user'] == AND $uparty['third_user'] == 0){
                    
$base -> query('DELETE FROM `pve` WHERE `party` = "'.$uparty['id'].'"');
                    
$base -> query('DELETE FROM `pve_log` WHERE `party_id` = "'.$uparty['id'].'"');
                }elseif(
$uparty['second_user'] != AND $uparty['third_user'] == 0){
                    
$base -> query('UPDATE `party` SET `first_user` = "'.$uparty['second_user'].'", `second_user` = "0" WHERE `id` = "'.$uparty['id'].'" LIMIT 1');
                }elseif(
$uparty['second_user'] != AND $uparty['third_user'] != 0){
                    
$base -> query('UPDATE `party` SET `first_user` = "'.$uparty['second_user'].'", `second_user` = "'.$uparty['third_user'].'", `third_user` = "0" WHERE `id` = "'.$uparty['id'].'" LIMIT 1');
                }
                if(
$uparty['second_user'] != OR $uparty['third_user'] != 0){
                    
$base -> query('INSERT INTO `pve_log` SET
                    `party_id` = "'
.$uparty['id'].'",
                    `pve_id` = "'
.$battle['id'].'",
                    `text` = "'
.$first_user['login'].' сражён..."');
                }
            if(
$first_user['id'] == $u['id']){
                unset(
$_SESSION['user_fast_log']);
                unset(
$_SESSION['enemy_fast_log']);
                
header('Location: /location/');
                exit;
            }
            
header('Location: /pve/');
        }
        if(isset(
$second_user) AND $second_user['hp'] <= 0){
            
$base -> query('UPDATE `users` SET
                `world` = "'
.$second_user['respawn_world'].'",
                `x` = "'
.$second_user['respawn_x'].'",
                `y` = "'
.$second_user['respawn_y'].'",
                `hp` = "'
.intval($second_user['max_hp'] / 4).'",
                `mp` = "'
.intval($second_user['max_mp'] / 4).'",
                `battle` = "no",
                `last_log` = "Поражение..."
                WHERE `id` = "'
.$second_user['id'].'" LIMIT 1');
            if(
$uparty['third_user'] != 0$base -> query('UPDATE `party` SET `second_user` = "'.$uparty['third_user'].'", `third_user` = "0" WHERE `id` = "'.$uparty['id'].'" LIMIT 1');
            else 
$base -> query('UPDATE `party` SET `second_user` = "0" WHERE `id` = "'.$uparty['id'].'" LIMIT 1');
            
$base -> query('INSERT INTO `pve_log` SET
            `party_id` = "'
.$uparty['id'].'",
            `pve_id` = "'
.$battle['id'].'",
            `text` = "'
.$second_user['login'].' сражён..."');
            if(
$second_user['id'] == $u['id']){
                unset(
$_SESSION['user_fast_log']);
                unset(
$_SESSION['enemy_fast_log']);
                
header('Location: /location/');
                exit;
            }
            
header('Location: /pve/');
        }
        if(isset(
$third_user) AND $third_user['hp'] <= 0){
            
$base -> query('UPDATE `users` SET
                `world` = "'
.$third_user['respawn_world'].'",
                `x` = "'
.$third_user['respawn_x'].'",
                `y` = "'
.$third_user['respawn_y'].'",
                `hp` = "'
.intval($third_user['max_hp'] / 4).'",
                `mp` = "'
.intval($third_user['max_mp'] / 4).'",
                `battle` = "no",
                `last_log` = "Поражение..."
                WHERE `id` = "'
.$third_user['id'].'" LIMIT 1');
            
$base -> query('UPDATE `party` SET `third_user` = "0" WHERE `id` = "'.$uparty['id'].'" LIMIT 1');
            
$base -> query('INSERT INTO `pve_log` SET
            `party_id` = "'
.$uparty['id'].'",
            `pve_id` = "'
.$battle['id'].'",
            `text` = "'
.$third_user['login'].' сражён..."');
            if(
$third_user['id'] == $u['id']){
                unset(
$_SESSION['user_fast_log']);
                unset(
$_SESSION['enemy_fast_log']);
                
header('Location: /location/');
                exit;
            }
            
header('Location: /pve/');
        }
}elseif(
$u['hp'] <= 0){
    if(
$u['training_step'] > 0){
        
$base -> query('UPDATE `users` SET `hp` = "30" WHERE `id` = "'.$u['id'].'" LIMIT 1');
        
header('Location: /pve/');
        exit;
    }
    
//Поражение
    
$base -> query('UPDATE `users` SET
        `world` = "'
.$u['respawn_world'].'",
        `x` = "'
.$u['respawn_x'].'",
        `y` = "'
.$u['respawn_y'].'",
        `hp` = "'
.intval($u['max_hp'] / 4).'",
        `mp` = "'
.intval($u['max_mp'] / 4).'",
        `battle` = "no",
        `last_log` = "Поражение..."
        WHERE `id` = "'
.$u['id'].'" LIMIT 1');
    
$base -> query('DELETE FROM `pve_log` WHERE `pve_id` = "'.$battle['id'].'"');
    
$base -> query('DELETE FROM `pve` WHERE `id` = "'.$battle['id'].'"');
    unset(
$_SESSION['user_fast_log']);
    unset(
$_SESSION['enemy_fast_log']);
    
header('Location: /location/');
    exit;
}

//Пьём зелья
if($action == 'potion'){
$potion $base -> query('SELECT * FROM `users_items` WHERE `user` = "'.$u['id'].'" AND `what` = "potion" AND `id` = "'.$_GET['potion'].'" LIMIT 1') -> fetch_assoc();
    if(
$potion 0){
        if(
$potion['id'] == $u['belt_slot_1'] OR $potion['id'] == $u['belt_slot_2'] OR $potion['id'] == $u['belt_slot_3']){
        
$time_potion = (time() - $u['last_'.$potion['potion'].'_potion']);
        if(
$time_potion >= 30){
            
$new_hp $u['hp'] + $potion['hp_regen'];
            if(
$new_hp $u['max_hp']) $new_hp $u['max_hp'];
            
$new_mp $u['mp'] + $potion['mp_regen'];
            if(
$new_mp $u['max_mp']) $new_mp $u['max_mp'];
            
$base -> query('UPDATE `users` SET `hp` = "'.$new_hp.'", `mp` = "'.$new_mp.'", `last_'.$potion['potion'].'_potion` = "'.time().'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
            
$new_amount $potion['amount'] - 1;
            if(
$new_amount <= 0){
                if(
$potion['id'] == $u['belt_slot_1']) $slot 1;
                if(
$potion['id'] == $u['belt_slot_2']) $slot 2;
                if(
$potion['id'] == $u['belt_slot_3']) $slot 3;
                
$base -> query('UPDATE `users` SET `belt_slot_'.$slot.'` = "0" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                
$base -> query('DELETE FROM `users_items` WHERE `id` = "'.$potion['id'].'"');
            }
            else 
$base -> query('UPDATE `users_items` SET `amount` = "'.$new_amount.'" WHERE `id` = "'.$potion['id'].'" LIMIT 1');
            
$base -> query('INSERT INTO `pve_log` SET
                `party_id` = "'
.$uparty['id'].'",
                `pve_id` = "'
.$battle['id'].'",
                `text` = "'
.$u['login'].' использовал '.$potion['name'].'."');
            if(
$potion['potion'] == 'hp'$_SESSION['user_fast_log'] = 'Восстановлено <font color="lime"><b>'.$potion['hp_regen'].'</b></font> здоровья.';
            if(
$potion['potion'] == 'mp'$_SESSION['user_fast_log'] = 'Восстановлено <font color="aqua"><b>'.$potion['mp_regen'].'</b></font> маны.';
        }
        }
    }
    
header('Location: /pve/');
    exit;
}

//Атака
if($action == 'attack'){
    
$time_attack = (time() - $battle['user_time_attack']);
    
$weapon $base -> query('SELECT * FROM `users_items` WHERE `id` = "'.$u['equip_right'].'" LIMIT 1') -> fetch_assoc();

    if(!
$weapon){
        
$type_attack $u['p_att'];
    }else{
        if(
$weapon['attack_type'] == 'p_att'$type_attack $u['p_att'];
        elseif(
$weapon['attack_type'] == 'm_att'$type_attack $u['m_att'];
    }

    if(
$time_attack >= 3$damage $type_attack;
    if(
$time_attack == 2$damage $type_attack 2;
    if(
$time_attack == 1$damage $type_attack 4;
    if(
$time_attack <= 0){
        
$damage 0;
        
$fast true;
    }

    
//Критический урон
    
if(mt_rand(0,100) < ($u['skill'] / 4)){
        
$damage $damage 2;
        
$critical true;
    }else{
        
$damage $damage;
        
$critical false;
    }

    if(
$type_attack == $u['p_att']) $mob_defense $mob['p_def'];
    elseif(
$type_attack == $u['m_att']) $mob_defense $mob['m_def'];
    
$mob_def mt_rand(($mob_defense 2), $mob_defense);
    
$damage $damage $mob_def;
    
$damage round($damage);

    if(
$damage 0){
        if(
$critical == true$log_critical ' Критический урон!';
        if(!
$uparty$base -> query('UPDATE `pve` SET `mob_hp` = `mob_hp` - "'.$damage.'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
        else 
$base -> query('UPDATE `pve` SET `mob_hp` = `mob_hp` - "'.$damage.'" WHERE `party` = "'.$uparty['id'].'"');
        
$base -> query('INSERT INTO `pve_log` SET
            `party_id` = "'
.$uparty['id'].'",
            `pve_id` = "'
.$battle['id'].'",
            `text` = "'
.$u['login'].' нанёс '.$damage.' урона.'.$log_critical.'"');
        if(
$critical == true$_SESSION['user_fast_log'] = 'Вы нанесли <font color="red"><b>'.$damage.'</b></font> урона!';
        else 
$_SESSION['user_fast_log'] = 'Вы нанесли <font color="yellow"><b>'.$damage.'</b></font> урона.';
        
$base -> query('UPDATE `pve` SET `user_time_attack` = "'.time().'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
        
header('Location: /pve/');
        exit;
    }elseif(
$damage <= 0){
        
$base -> query('INSERT INTO `pve_log` SET
            `party_id` = "'
.$uparty['id'].'",
            `pve_id` = "'
.$battle['id'].'",
            `text` = "'
.$u['login'].' нанёс 0 урона..."');
        if(
$fast == true$_SESSION['user_fast_log'] = 'Слишком часто...';
        else 
$_SESSION['user_fast_log'] = 'Вы нанесли <font color="yellow"><b>0</b></font> урона.';
    }
}

//Умение
if($action == 'skill'){
    
$skill $base -> query('SELECT * FROM `users_skills` WHERE `user` = "'.$u['id'].'" AND `id` = "'.$_GET['skill'].'" LIMIT 1') -> fetch_assoc();
    if(!
$skill){
            
header('Location: /pve/');
            exit;
        }else{
            if(
$u['mp'] < $skill['mp_need']){
                
header('Location: /pve/');
                exit;
            }else{
                
$time_skill = (time() - $skill['cool_down_time']);

                if(
$time_skill $skill['cool_down']){
                        
header('Location: /pve/');
                        exit;
                }else{
                    if(
$skill['id'] == $u['skill_slot_1'] OR $skill['id'] == $u['skill_slot_2'] OR $skill['id'] == $u['skill_slot_3']){
                    if(
$skill['type'] == 'attack'){
                        
//Атакующее умение
                        
$time_attack = (time() - $battle['user_time_attack']);

                        if(
$skill['type_attack'] == 'p_att'$type_attack $u['p_att'];
                        elseif(
$skill['type_attack'] == 'm_att'$type_attack $u['m_att'];

                        if(
$time_attack >= 3$damage $type_attack;
                        if(
$time_attack == 2$damage $type_attack 2;
                        if(
$time_attack == 1$damage $type_attack 4;
                        if(
$time_attack <= 0$damage 0;

                        
$damage $damage $skill['how_many'];

                        
//Критический урон
                        
if(mt_rand(0,100) < ($u['skill'] / 4)){
                            
$damage $damage 2;
                            
$critical true;
                        }else{
                            
$damage $damage;
                            
$critical false;
                        }

                        if(
$skill['type_attack'] == 'p_att'$mob_defense $mob['p_def'];
                        elseif(
$skill['type_attack'] == 'm_att'$mob_defense $mob['m_def'];
                        
$mob_def mt_rand(($mob_defense 2), $mob_defense);
                        
$damage $damage $mob_def;
                        
$damage round($damage);

                        if(
$damage 0){
                            if(
$critical == true$log_critical ' Критический урон!';
                            if(!
$uparty$base -> query('UPDATE `pve` SET `mob_hp` = `mob_hp` - "'.$damage.'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
                            else 
$base -> query('UPDATE `pve` SET `mob_hp` = `mob_hp` - "'.$damage.'" WHERE `party` = "'.$uparty['id'].'"');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и нанёс '.$damage.' урона.'.$log_critical.'"');
                            if(
$critical == true$_SESSION['user_fast_log'] = 'Вы нанесли <font color="magenta"><b>'.$damage.'</b></font> урона!';
                            else 
$_SESSION['user_fast_log'] = 'Вы нанесли <font color="violet"><b>'.$damage.'</b></font> урона.';
                        }else{
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].', но промахнулся..."');
                            
$_SESSION['user_fast_log'] = 'Вы промахнулись...';
                        }
                        
$base -> query('UPDATE `users` SET `mp` = `mp` - "'.$skill['mp_need'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        
$base -> query('UPDATE `users_skills` SET `cool_down_time` = "'.time().'" WHERE `id` = "'.$skill['id'].'" LIMIT 1');
                        
header('Location: /pve/');
                        exit;

                    }elseif(
$skill['type'] == 'heal'){
                        
//Лечащее умение
                        
$new_hp $u['hp'] + $skill['how_many'];
                        if(
$new_hp $u['max_hp']) $new_hp $u['max_hp'];
                        
$base -> query('UPDATE `users` SET `hp` = "'.$new_hp.'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        
$base -> query('INSERT INTO `pve_log` SET
                            `party_id` = "'
.$uparty['id'].'",
                            `pve_id` = "'
.$battle['id'].'",
                            `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил '.$skill['how_many'].' здоровья."');
                        
$_SESSION['user_fast_log'] = 'Восстановлено <font color="lime"><b>'.$skill['how_many'].'</b></font> здоровья.';
                        
$base -> query('UPDATE `users` SET `mp` = `mp` - "'.$skill['mp_need'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        
$base -> query('UPDATE `users_skills` SET `cool_down_time` = "'.time().'" WHERE `id` = "'.$skill['id'].'" LIMIT 1');
                        
header('Location: /pve/');
                        exit;

                    }elseif(
$skill['type'] == 'massive_heal'){
                        
//Массивное лечащее умение
                        
if($uparty){
                        
$t_u_i_b_q $base -> query('SELECT * FROM `pve` WHERE `user` = "'.$uparty['third_user'].'" LIMIT 1');
                        
$t_u_i_b_nr $t_u_i_b_q -> num_rows;
                        
$tu_id_battle $t_u_i_b_q -> fetch_assoc();
                        
$s_u_i_b_q $base -> query('SELECT * FROM `pve` WHERE `user` = "'.$uparty['second_user'].'" LIMIT 1');
                        
$s_u_i_b_nr $s_u_i_b_q -> num_rows;
                        
$su_id_battle $s_u_i_b_q -> fetch_assoc();
                        
$f_u_i_b_q $base -> query('SELECT * FROM `pve` WHERE `user` = "'.$uparty['first_user'].'" LIMIT 1');
                        
$f_u_i_b_nr $f_u_i_b_q -> num_rows;
                        
$fu_id_battle $f_u_i_b_q -> fetch_assoc();
                        if(
$t_u_i_b_nr 0){
                            
$skill['how_many'] = intval($skill['how_many'] / 3);
                            
$new_tu_hp $third_user['hp'] + $skill['how_many'];
                            if(
$new_tu_hp $third_user['max_hp']) $new_tu_hp $third_user['max_hp'];
                            
$t_u_b_i $base -> query('SELECT * FROM `pve` WHERE `user` = "'.$uparty['third_user'].'" LIMIT 1');
                            
$new_su_hp $second_user['hp'] + $skill['how_many'];
                            if(
$new_su_hp $second_user['max_hp']) $new_su_hp $second_user['max_hp'];
                            
$new_fu_hp $first_user['hp'] + $skill['how_many'];
                            if(
$new_fu_hp $first_user['max_hp']) $new_fu_hp $first_user['max_hp'];
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_fu_hp.'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_su_hp.'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_tu_hp.'" WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$fu_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$su_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$tu_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
                        }elseif(
$s_u_i_b_nr 0){
                            
$skill['how_many'] = intval($skill['how_many'] / 2);
                            
$new_su_hp $second_user['hp'] + $skill['how_many'];
                            if(
$new_su_hp $second_user['max_hp']) $new_su_hp $second_user['max_hp'];
                            
$new_fu_hp $first_user['hp'] + $skill['how_many'];
                            if(
$new_fu_hp $first_user['max_hp']) $new_fu_hp $first_user['max_hp'];
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_fu_hp.'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_su_hp.'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$fu_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$su_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
                        }elseif(
$f_u_i_b_nr 0){
                            
$new_fu_hp $first_user['hp'] + $skill['how_many'];
                            if(
$new_fu_hp $first_user['max_hp']) $new_fu_hp $first_user['max_hp'];
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_fu_hp.'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$fu_id_battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил '.$skill['how_many'].' здоровья."');
                        }
                        }else{
                            
$new_hp $u['hp'] + $skill['how_many'];
                            if(
$new_hp $u['max_hp']) $new_hp $u['max_hp'];
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_hp.'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                            
$base -> query('INSERT INTO `pve_log` SET
                                `party_id` = "'
.$uparty['id'].'",
                                `pve_id` = "'
.$battle['id'].'",
                                `text` = "'
.$u['login'].' использовал '.$skill['name'].' и восстановил '.$skill['how_many'].' здоровья."');
                        }

                        
$_SESSION['user_fast_log'] = 'Восстановлено <font color="lime"><b>'.$skill['how_many'].'</b></font> здоровья.';
                        
$base -> query('UPDATE `users` SET `mp` = `mp` - "'.$skill['mp_need'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        
$base -> query('UPDATE `users_skills` SET `cool_down_time` = "'.time().'" WHERE `id` = "'.$skill['id'].'" LIMIT 1');
                        
header('Location: /pve/');
                        exit;

                    }elseif(
$skill['type'] == 'buff'){
                        
//Усиление либо ослабление
                        
$buff $base -> query('SELECT * FROM `skills` WHERE `ident_id` = "'.$skill['ident_id'].'" AND `level` = "'.$skill['level'].'" LIMIT 1') -> fetch_assoc();
                        
$base -> query('INSERT INTO `buffs` SET
                            `user` = "'
.$u['id'].'",
                            `buff` = "'
.$buff['id'].'",
                            `time` = "'
.time().'"');
                        
$base -> query('UPDATE `users` SET
                            `p_att` = `p_att` + "'
.$buff['p_att'].'",
                            `m_att` = `m_att` + "'
.$buff['m_att'].'",
                            `p_def` = `p_def` + "'
.$buff['p_def'].'",
                            `m_def` = `m_def` + "'
.$buff['m_def'].'",
                            `endurance` = `endurance` + "'
.$buff['endurance'].'",
                            `intellect` = `intellect` + "'
.$buff['intellect'].'",
                            `agility` = `agility` + "'
.$buff['agility'].'",
                            `skill` = `skill` + "'
.$buff['skill'].'"
                            WHERE `id` = "'
.$u['id'].'" LIMIT 1');
                        
$base -> query('INSERT INTO `pve_log` SET
                            `party_id` = "'
.$uparty['id'].'",
                            `pve_id` = "'
.$battle['id'].'",
                            `text` = "'
.$u['login'].' наложил на себя усиление '.$skill['name'].'."');
                        
//Дар природы
                        
if($buff['ident_id'] == 5){
                            
$how_hp $buff['endurance'] * 20;
                            
$new_hp $u['hp'] + $how_hp;
                            
//if($new_hp > $u['max_hp']) $new_hp = $u['max_hp'];
                            
$base -> query('UPDATE `users` SET `hp` = "'.$new_hp.'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        }
                        
$base -> query('UPDATE `users` SET `mp` = `mp` - "'.$skill['mp_need'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
                        
$base -> query('UPDATE `users_skills` SET `cool_down_time` = "'.time().'" WHERE `id` = "'.$skill['id'].'" LIMIT 1');
                        
header('Location: /pve/');
                        exit;
                }
                }
            }
        }
    }
}

//Атака моба
$attack_count intval((time() - $battle['mob_time_attack']) / $mob['time_attack']);
$i 1;
while(
$i++<=$attack_count){

    if(!
$uparty$user_target $u;
    else 
$user_target $first_user;

    if(
$mob['p_att'] > $mob['m_att']) $mob_type_attack $mob['p_att'];
    elseif(
$mob['m_att'] > $mob['p_att']) $mob_type_attack $mob['m_att'];

    
$mob_damage mt_rand(($mob_type_attack - ($mob_type_attack 4)),$mob_type_attack);

    if(
$mob_type_attack == $mob['p_att']) $user_defense $user_target['p_def'];
    elseif(
$mob_type_attack == $mob['m_att']) $user_defense $user_target['m_def'];
    
$user_def mt_rand(($user_defense 2), $user_defense);
    if(
$user_def 0$user_def 0;
    
$mob_damage $mob_damage $user_def;

    
//Шанс уворота
    
if(mt_rand(0,100) < ($user_target['agility'] / 4)) $dodge true;
    else 
$dodge false;

    if(
$dodge == true){
        if(!
$uparty){
            
$base -> query('INSERT INTO `pve_log` SET
                    `pve_id` = "'
.$battle['id'].'",
                    `text` = "'
.$mob['name'].' пытался атаковать, но вы увернулись."');
            
$_SESSION['enemy_fast_log'] = ''.$mob['name'].' промахнулся...';
        }else{
            
$base -> query('INSERT INTO `pve_log` SET
                    `party_id` = "'
.$uparty['id'].'",
                    `pve_id` = "'
.$battle['id'].'",
                    `text` = "'
.$mob['name'].' пытался атаковать, но '.$user_target['login'].' увернулся."');
            
$_SESSION['enemy_fast_log'] = ''.$mob['name'].' промахнулся...';
        }
    }else{
        if(
$mob_damage 0){
            
$base -> query('UPDATE `users` SET `hp` = `hp` - "'.$mob_damage.'" WHERE `id` = "'.$user_target['id'].'" LIMIT 1');
            if(!
$uparty){
                
$base -> query('INSERT INTO `pve_log` SET
                    `pve_id` = "'
.$battle['id'].'",
                    `text` = "'
.$mob['name'].' нанёс вам '.$mob_damage.' урона."');
            }else{
                
$base -> query('INSERT INTO `pve_log` SET
                    `party_id` = "'
.$uparty['id'].'",
                    `pve_id` = "'
.$battle['id'].'",
                    `text` = "'
.$mob['name'].' нанёс '.$user_target['login'].' '.$mob_damage.' урона."');
            }
        
$_SESSION['enemy_fast_log'] = ''.$mob['name'].' нанёс <font color="yellow"><b>'.$mob_damage.'</b></font> урона.';
        }else{
            
$base -> query('INSERT INTO `pve_log` SET
                `party_id` = "'
.$uparty['id'].'",
                `pve_id` = "'
.$battle['id'].'",
                `text` = "'
.$mob['name'].' промахнулся..."');
            
$_SESSION['enemy_fast_log'] = ''.$mob['name'].' промахнулся...';
        }
    }
    if(
$i $attack_count){
        if(!
$uparty$base -> query('UPDATE `pve` SET `mob_time_attack` = "'.time().'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
        else 
$base -> query('UPDATE `pve` SET `mob_time_attack` = "'.time().'" WHERE `party` = "'.$uparty['id'].'"');
        
header('Location: /pve/');
        exit;
    }
}

//echo '<div class="b">';

$background '/images/locations/backgrounds/'.$uloc['location_type'].'.png';
echo 
'<div class="border" style="margin-top: 5px; box-sizing: border-box;">';
echo 
'<div style="width: 100%; max-width: 336px; height: 248px; background: url('.$background.') no-repeat center;">';

//Быстрые логи
echo '<table width="100%" height="15%" style="font-size: 10px; text-shadow: black 1px 1px 1px; color: white;"><tr>';
echo 
'<td width="50%" valign="top">';
if(isset(
$_SESSION['user_fast_log'])){
    echo 
'<div class="fast_log">';
    echo 
'<center>'.$_SESSION['user_fast_log'].'</center>';
    echo 
'</div>';
    unset(
$_SESSION['user_fast_log']);
}
echo 
'</td>';
echo 
'<td width="50%" valign="top">';
if(isset(
$_SESSION['enemy_fast_log'])){
    echo 
'<div class="fast_log">';
    echo 
'<center>'.$_SESSION['enemy_fast_log'].'</center>';
    echo 
'</div>';
    unset(
$_SESSION['enemy_fast_log']);
}
echo 
'</td></tr></table>';

echo 
'<table width="100%" height="85%" style="position: relative;"><tr><td width="50%"><center>';

//Если игрок в команде
if($uparty){
    if(isset(
$first_user)){
        
$buffs_q $base -> query('SELECT * FROM `buffs` WHERE `user` = "'.$first_user['id'].'"');
        
$buffs_nr $buffs_q -> num_rows;
        
$first_user_skin='/images/skins/'.$first_user['skin'].'_right.gif';
        
$first_user_hp round($first_user['hp'] / $first_user['max_hp'] * 100,1);
        
$first_user_mp round($first_user['mp'] / $first_user['max_mp'] * 100,1);
        if(
$first_user_hp 100$first_user_hp 100;
        if(
$first_user_mp 100$first_user_mp 100;
        echo 
'<div style="position: absolute; bottom: 30%; left: 20%; width: 35%; z-index: 9997;"><font style="text-shadow: black 1px 1px 1px; color: '.$first_user['login_color'].'; font-size: 11px;">'.$first_user['login'].'</font><br/>
        <div class="hp_small" style="background-size: '
.$first_user_hp.'% 2px; margin-bottom: 0px;"></div><br/>
        <div class="mp_small" style="background-size: '
.$first_user_mp.'% 2px;"></div><br/><img src="'.$first_user_skin.'"></div>';
        if(
$buffs_nr 0){
            echo 
'<div style="position: absolute; bottom: 46%; left: 20%; width: 25%; z-index: 9997; padding-left: 5%;" align="left">';
            while(
$buffs $buffs_q -> fetch_assoc()){
                
$buff $base -> query('SELECT * FROM `skills` WHERE `id` = "'.$buffs['buff'].'" LIMIT 1') -> fetch_assoc();
                
$buff_remain_time = ($buffs['time'] + $buff['duration']) - time();
                
$remain_percents round($buff_remain_time $buff['duration'] * 100,1);
                echo 
'<div style="background: black; width: 10px; border: 1px solid black; display: inline-block;"><img src="/images/skills/'.$buff['image'].'.png" style="width: 10px;"><br/><div style ="background: #28BD28; height: 1px; width: '.$remain_percents.'%; display: inline-block;"></div></div>';
            }
            echo 
'</div>';
        }
    }
    if(isset(
$second_user)){
        
$buffs_q $base -> query('SELECT * FROM `buffs` WHERE `user` = "'.$second_user['id'].'"');
        
$buffs_nr $buffs_q -> num_rows;
        
$second_user_skin='/images/skins/'.$second_user['skin'].'_right.gif';
        
$second_user_hp round($second_user['hp'] / $second_user['max_hp'] * 100,1);
        
$second_user_mp round($second_user['mp'] / $second_user['max_mp'] * 100,1);
        if(
$second_user_hp 100$second_user_hp 100;
        if(
$second_user_mp 100$second_user_mp 100;
        echo 
'<div style="position: absolute; bottom: 50%; left: 0%; width: 35%; z-index: 9996;"><font style="text-shadow: black 1px 1px 1px; color: '.$second_user['login_color'].'; font-size: 11px;">'.$second_user['login'].'</font><br/>
        <div class="hp_small" style="background-size: '
.$second_user_hp.'% 2px; margin-bottom: 0px;"></div><br/>
        <div class="mp_small" style="background-size: '
.$second_user_mp.'% 2px;"></div><br/><img src="'.$second_user_skin.'"></div>';
        if(
$buffs_nr 0){
            echo 
'<div style="position: absolute; bottom: 66%; left: 0%; width: 25%; z-index: 9996; padding-left: 5%;" align="left">';
            while(
$buffs $buffs_q -> fetch_assoc()){
                
$buff $base -> query('SELECT * FROM `skills` WHERE `id` = "'.$buffs['buff'].'" LIMIT 1') -> fetch_assoc();
                
$buff_remain_time = ($buffs['time'] + $buff['duration']) - time();
                
$remain_percents round($buff_remain_time $buff['duration'] * 100,1);
                echo 
'<div style="background: black; width: 10px; border: 1px solid black; display: inline-block;"><img src="/images/skills/'.$buff['image'].'.png" style="width: 10px;"><br/><div style ="background: #28BD28; height: 1px; width: '.$remain_percents.'%; display: inline-block;"></div></div>';
            }
            echo 
'</div>';
        }
    }
    if(isset(
$third_user)){
        
$buffs_q $base -> query('SELECT * FROM `buffs` WHERE `user` = "'.$third_user['id'].'"');
        
$buffs_nr $buffs_q -> num_rows;
        
$third_user_skin='/images/skins/'.$third_user['skin'].'_right.gif';
        
$third_user_hp round($third_user['hp'] / $third_user['max_hp'] * 100,1);
        
$third_user_mp round($third_user['mp'] / $third_user['max_mp'] * 100,1);
        if(
$third_user_hp 100$third_user_hp 100;
        if(
$third_user_mp 100$third_user_mp 100;
        echo 
'<div style="position: absolute; bottom: 5%; left: 0%; width: 35%; z-index: 9998;"><font style="text-shadow: black 1px 1px 1px; color: '.$third_user['login_color'].'; font-size: 11px;">'.$third_user['login'].'</font><br/>
        <div class="hp_small" style="background-size: '
.$third_user_hp.'% 2px; margin-bottom: 0px;"></div><br/>
        <div class="mp_small" style="background-size: '
.$third_user_mp.'% 2px;"></div><br/><img src="'.$third_user_skin.'"></div>';
        if(
$buffs_nr 0){
            echo 
'<div style="position: absolute; bottom: 21%; left: 0%; width: 25%; z-index: 9998; padding-left: 5%;" align="left">';
            while(
$buffs $buffs_q -> fetch_assoc()){
                
$buff $base -> query('SELECT * FROM `skills` WHERE `id` = "'.$buffs['buff'].'" LIMIT 1') -> fetch_assoc();
                
$buff_remain_time = ($buffs['time'] + $buff['duration']) - time();
                
$remain_percents round($buff_remain_time $buff['duration'] * 100,1);
                echo 
'<div style="background: black; width: 10px; border: 1px solid black; display: inline-block;"><img src="/images/skills/'.$buff['image'].'.png" style="width: 10px;"><br/><div style ="background: #28BD28; height: 1px; width: '.$remain_percents.'%; display: inline-block;"></div></div>';
            }
            echo 
'</div>';
        }
    }
}else{
    
$buffs_q $base -> query('SELECT * FROM `buffs` WHERE `user` = "'.$u['id'].'"');
    
$buffs_nr $buffs_q -> num_rows;
    echo 
'<div style="position: absolute; bottom: 35%; left: 10%; width: 35%;"><font style="text-shadow: black 1px 1px 1px; color: '.$u['login_color'].'; font-size: 12px;">'.$u['login'].'</font><br/>
    <div class="hp_small" style="background-size: '
.$now_hp.'% 2px;"></div><br/>
    <div class="mp_small" style="background-size: '
.$now_mp.'% 2px;"></div><br/><img src="/images/skins/'.$u['skin'].'_right.gif"></div>';
    if(
$buffs_nr 0){
            echo 
'<div style="position: absolute; bottom: 51%; left: 10%; width: 25%; padding-left: 5%;" align="left">';
            while(
$buffs $buffs_q -> fetch_assoc()){
                
$buff $base -> query('SELECT * FROM `skills` WHERE `id` = "'.$buffs['buff'].'" LIMIT 1') -> fetch_assoc();
                
$buff_remain_time = ($buffs['time'] + $buff['duration']) - time();
                
$remain_percents round($buff_remain_time $buff['duration'] * 100,1);
                echo 
'<div style="background: black; width: 10px; border: 1px solid black; display: inline-block;"><img src="/images/skills/'.$buff['image'].'.png" style="width: 10px;"><br/><div style ="background: #28BD28; height: 1px; width: '.$remain_percents.'%; display: inline-block;"></div></div>';
            }
            echo 
'</div>';
    }
}

$mob_hp_percents round($battle['mob_hp']/$battle['mob_max_hp']*100,1);
if(
$mob_hp_percents 100$mob_hp_percents 100;

echo 
'<center></td><td width="50%" style="position: relative;"><center><small><font style="text-shadow: black 1px 1px 1px; color: #FFFFFF;">'.$mob['name'].'</font></small><br/><a href="/pve/attack/"><img style="max-height: 122px;" src="/images/mobs/'.$mob['image'].'"></a></center>
<center><div class="hp" style="width: 75%; background-size: '
.$mob_hp_percents.'% 12px; text-shadow: black 0 1px 0; text-align: left;"><font color="#E0E0E0" size="1">HP: '.n_f($battle['mob_hp']).'/'.n_f($battle['mob_max_hp']).'</font></div></center>';

//Кнопка атаки
echo '<br/><br/><div style="position: absolute; bottom: 0.5%; right: 0.5%;">';
if(
$u['equip_right'] == '0'){
    echo 
'<a href="/pve/attack/"><img  src="/images/skills/punch.png" style=" border: 1px solid #B1B1B1;" width="40px"></a>';
}else{
    
$weapon $base -> query('SELECT * FROM `users_items` WHERE `id` = "'.$u['equip_right'].'" LIMIT 1') -> fetch_assoc();
    if(
$weapon['mark'] == '0'$border_color 'B1B1B1';
    if(
$weapon['mark'] == '1'$border_color '30C030';
    if(
$weapon['mark'] == '2'$border_color '68A8F9';
    if(
$weapon['mark'] == '3'$border_color 'D8CD32';
    if(
$weapon['mark'] == '4'$border_color 'DD4FFF';
    echo 
'<a href="/pve/attack/"><img src="/images/items/right/'.$weapon['image'].'.png" style=" border: 1px solid #'.$border_color.';" width="40px"></a>';
}
echo 
'</div>';
echo 
'</td>';
echo 
'</tr></table>';
echo 
'</div></div>';

//Действия
echo '<center>';
echo 
'<table style="width: 100%; max-width: 303px;" cellspacing="3px"><tr>';
echo 
'<td class="event" width="50%">';
//Пояс с зельями
if($u['belt_slot_1'] > 0){
        
$bs $base -> query("SELECT * FROM `users_items` WHERE `id` = '".$u['belt_slot_1']."' LIMIT 1") -> fetch_assoc();
        
$time_potion = (time() - $u['last_'.$bs['potion'].'_potion']);
        
$time_cool_down_potion 30 - (time() - $u['last_'.$bs['potion'].'_potion']);
        if(
$bs['mark'] == '0'$border_color 'B1B1B1';
        if(
$bs['mark'] == '1'$border_color '30C030';
        if(
$bs['mark'] == '2'$border_color '68A8F9';
        if(
$bs['mark'] == '3'$border_color 'D8CD32';
        if(
$bs['mark'] == '4'$border_color 'DD4FFF';
        if(
$time_potion >= 30){
            echo 
'<a class="potion" style="width: 42px; height: 42px; border: 1px solid #'.$border_color.';" href="/pve/potion/'.$bs['id'].'/"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42; height: 42px;">
            <div style="padding-top: 70%; padding-right: 3px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px; float: right;">'
.$bs['amount'].'</font></div></div></a>';
        }else{
            echo 
'<div class="potion" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
            <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
            <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down_potion).'</font></div></div></div></div>';
        }
    }else{
        echo 
'<div class="potion" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
if(
$u['belt_slot_2'] > 0){
        
$bs $base -> query("SELECT * FROM `users_items` WHERE `id` = '".$u['belt_slot_2']."' LIMIT 1") -> fetch_assoc();
        
$time_potion = (time() - $u['last_'.$bs['potion'].'_potion']);
        
$time_cool_down_potion 30 - (time() - $u['last_'.$bs['potion'].'_potion']);
        if(
$bs['mark'] == '0'$border_color 'B1B1B1';
        if(
$bs['mark'] == '1'$border_color '30C030';
        if(
$bs['mark'] == '2'$border_color '68A8F9';
        if(
$bs['mark'] == '3'$border_color 'D8CD32';
        if(
$bs['mark'] == '4'$border_color 'DD4FFF';
        if(
$time_potion >= 30){
            echo 
'<a class="potion" style="width: 42px; height: 42px; border: 1px solid #'.$border_color.';" href="/pve/potion/'.$bs['id'].'/"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42; height: 42px;">
            <div style="padding-top: 70%; padding-right: 3px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px; float: right;">'
.$bs['amount'].'</font></div></div></a>';
        }else{
            echo 
'<div class="potion" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
            <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
            <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down_potion).'</font></div></div></div></div>';
        }
    }else{
        echo 
'<div class="potion" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
if(
$u['belt_slot_3'] > 0){
        
$bs $base -> query("SELECT * FROM `users_items` WHERE `id` = '".$u['belt_slot_3']."' LIMIT 1") -> fetch_assoc();
        
$time_potion = (time() - $u['last_'.$bs['potion'].'_potion']);
        
$time_cool_down_potion 30 - (time() - $u['last_'.$bs['potion'].'_potion']);
        if(
$bs['mark'] == '0'$border_color 'B1B1B1';
        if(
$bs['mark'] == '1'$border_color '30C030';
        if(
$bs['mark'] == '2'$border_color '68A8F9';
        if(
$bs['mark'] == '3'$border_color 'D8CD32';
        if(
$bs['mark'] == '4'$border_color 'DD4FFF';
        if(
$time_potion >= 30){
            echo 
'<a class="potion" style="width: 42px; height: 42px; border: 1px solid #'.$border_color.';" href="/pve/potion/'.$bs['id'].'/"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42; height: 42px;">
            <div style="padding-top: 70%; padding-right: 3px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px; float: right;">'
.$bs['amount'].'</font></div></div></a>';
        }else{
            echo 
'<div class="potion" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/items/resource/'.$bs['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
            <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
            <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down_potion).'</font></div></div></div></div>';
        }
    }else{
        echo 
'<div class="potion" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
echo 
'</td>';
echo 
'<td class="event" width="50%">';
//Умения
if($u['skill_slot_1'] > 0){
        
$ss $base -> query("SELECT * FROM `users_skills` WHERE `id` = '".$u['skill_slot_1']."' LIMIT 1") -> fetch_assoc();
        if(
$ss['book'] == 'fire'$border_color 'orangered';
        if(
$ss['book'] == 'earth'$border_color 'limegreen';
        if(
$ss['book'] == 'water'$border_color 'dodgerblue';
        if(
$u['mp'] >= $ss['mp_need']){
            
$time_skill = (time() - $ss['cool_down_time']);
            
$time_cool_down $ss['cool_down'] - (time() - $ss['cool_down_time']);
            if(
$time_skill >= $ss['cool_down']){
                echo 
'<a class="skill" style="width: 42px; height: 42px; border: 1px solid '.$border_color.';" href="/pve/skill/'.$ss['id'].'/"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;"></div></a>';
            }else{
                echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down).'</font></div></div></div></div>';
            }
        }else{
            echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">НМ</font></div></div></div></div>'
;
        }
    }else{
        echo 
'<div class="skill" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
if(
$u['skill_slot_2'] > 0){
        
$ss $base -> query("SELECT * FROM `users_skills` WHERE `id` = '".$u['skill_slot_2']."' LIMIT 1") -> fetch_assoc();
        if(
$ss['book'] == 'fire'$border_color 'orangered';
        if(
$ss['book'] == 'earth'$border_color 'limegreen';
        if(
$ss['book'] == 'water'$border_color 'dodgerblue';
        if(
$u['mp'] >= $ss['mp_need']){
            
$time_skill = (time() - $ss['cool_down_time']);
            
$time_cool_down $ss['cool_down'] - (time() - $ss['cool_down_time']);
            if(
$time_skill >= $ss['cool_down']){
                echo 
'<a class="skill" style="width: 42px; height: 42px; border: 1px solid '.$border_color.';" href="/pve/skill/'.$ss['id'].'/"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;"></div></a>';
            }else{
                echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down).'</font></div></div></div></div>';
            }
        }else{
            echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">НМ</font></div></div></div></div>'
;
        }
    }else{
        echo 
'<div class="skill" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
if(
$u['skill_slot_3'] > 0){
        
$ss $base -> query("SELECT * FROM `users_skills` WHERE `id` = '".$u['skill_slot_3']."' LIMIT 1") -> fetch_assoc();
        if(
$ss['book'] == 'fire'$border_color 'orangered';
        if(
$ss['book'] == 'earth'$border_color 'limegreen';
        if(
$ss['book'] == 'water'$border_color 'dodgerblue';
        if(
$u['mp'] >= $ss['mp_need']){
            
$time_skill = (time() - $ss['cool_down_time']);
            
$time_cool_down $ss['cool_down'] - (time() - $ss['cool_down_time']);
            if(
$time_skill >= $ss['cool_down']){
                echo 
'<a class="skill" style="width: 42px; height: 42px; border: 1px solid '.$border_color.';" href="/pve/skill/'.$ss['id'].'/"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;"></div></a>';
            }else{
                echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">'
.tl($time_cool_down).'</font></div></div></div></div>';
            }
        }else{
            echo 
'<div class="skill" style="width: 42px; height: 42px; border: 1px solid gray;"><div style="background: url(/images/skills/'.$ss['image'].'.png) no-repeat center; background-size: 100%; display: inline-block; width: 42px; height: 42px;">
                <div style="background: url(/images/skills/opacity.png) no-repeat center; background-size: 100%; width: 42px; height: 42px;">
                <div style="padding-top: 14px;"><font style="text-shadow: black 1px 1px 1px; color: #e0e0e0; font-size: 10px;">НМ</font></div></div></div></div>'
;
        }
    }else{
        echo 
'<div class="skill" style="border: 1px solid gray; height: 31px; width: 42px;font-size: 13px; padding-top: 11px; display: inline-block; color: gray;">пусто</div>';
    }
echo 
'</td>';
echo 
'</tr></table>';
echo 
'</center>';

//Лог
if(!$uparty$log_q $base -> query('SELECT * FROM `pve_log` WHERE `pve_id` = "'.$battle['id'].'" ORDER BY `id` DESC LIMIT 3');
else 
$log_q $base -> query('SELECT * FROM `pve_log` WHERE `party_id` = "'.$uparty['id'].'" ORDER BY `id` DESC LIMIT 3');
$log_nr $log_q -> num_rows;

if(
$log_nr 0){

echo 
'<center><table style="width: 100%; max-width: 335px;"><tr><td class="event">';
while(
$log $log_q -> fetch_assoc()){
    echo 
'<div style="margin-top: 2px; color: #B1B1B1; font-size: 12px;"><img src="/images/icons/topic.png" width="16px"> '.$log['text'].'</div>';
}
echo 
'</td></tr></table></center>';

}

//echo '<br/><a class="btn" href="/pve/escape/"><img src="/images/icons/agility.png"> Сбежать</a>';

//echo '</div>';

}

include_once (
'core/foot.php');
?>
Онлайн: 0
Реклама