Файл: pvb.php
Строк: 1001
<?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 `pvb` WHERE `user` = "'.$u['id'].'" LIMIT 1') -> fetch_assoc();
else $battle = $base -> query('SELECT * FROM `pvb` WHERE `party` = "'.$uparty['id'].'" AND `user` = "'.$u['id'].'" LIMIT 1') -> fetch_assoc();
if(!$battle){
//$_SESSION['message'] = 'Бой не найден...';
if($u['battle'] == 'pvb') $base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$u['id'].'" LIMIT 1');
header('Location: /location/');
exit;
}else{
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();
}
$boss = $base -> query('SELECT * FROM `mobs` WHERE `id` = "'.$battle['boss'].'" LIMIT 1') -> fetch_assoc();
if((time() - $boss['boss_time_dead']) < $boss['boss_respawn_time']){
if(!$uparty){
$base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$u['id'].'" LIMIT 1');
$base -> query('DELETE FROM `pvb` WHERE `id` = "'.$battle['id'].'"');
$base -> query('DELETE FROM `pvb_log` WHERE `pvb_id` = "'.$battle['id'].'"');
}else{
if($first_user) $base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
if($second_user) $base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
if($third_user) $base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1');
$base -> query('DELETE FROM `pvb` WHERE `party` = "'.$uparty['id'].'"');
$base -> query('DELETE FROM `pvb_log` WHERE `party_id` = "'.$uparty['id'].'"');
}
header('Location: /location/');
exit;
}
if($boss['hp'] <= 0){
//Победа
$drops = $base -> query('SELECT * FROM `drops` WHERE `mob` = "'.$boss['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){
$boss['exp'] = $boss['exp'] + ($boss['exp'] / 2);
$boss['silver'] = $boss['silver'] + ($boss['silver'] / 2);
}elseif($u['vip'] == 2){
$boss['exp'] = $boss['exp'] * 2;
$boss['silver'] = $boss['silver'] * 2;
}elseif($u['vip'] == 3){
$boss['exp'] = $boss['exp'] * 2 + ($boss['exp'] / 2);
$boss['silver'] = $boss['silver'] * 2 + ($boss['silver'] / 2);
}
}
$boss['exp'] = intval($boss['exp']);
$boss['silver'] = intval($boss['silver']);
if($uclan){
$clan_exp = $boss['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');
//$clan_exp_plus = '<br/>Получено кланового опыта: <img src="/images/icons/exp.png" width="16px">'.intval($clan_exp).'';
}
if($uparty['third_user'] != 0){
//$exp = intval($boss['exp'] / 3);
//$silver = intval($boss['silver'] / 3);
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$uparty['third_user'].'" LIMIT 1');
}elseif($uparty['second_user'] != 0){
//$exp = intval($boss['exp'] / 2);
//$silver = intval($boss['silver'] / 2);
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$uparty['first_user'].'" LIMIT 1');
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$uparty['second_user'].'" LIMIT 1');
}else{
//$exp = $boss['exp'];
//$silver = $boss['silver'];
$base -> query('UPDATE `users` SET `exp` = `exp` + "'.$boss['exp'].'", `silver` = `silver` + "'.$boss['silver'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
}
$quest_q = $base -> query('SELECT * FROM `users_quests` WHERE `user` = "'.$u['id'].'" AND `kill_mob_id` = "'.$boss['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` = "'.$boss['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_boss_kill = '<br/>"'.$quest['name'].'": '.$quest_progress.'';
}
$base -> query("INSERT INTO `chat` (`user`,`text`,`time`) VALUES (1,'".$boss['name']." сражён от руки ".$u['login']."!','".time()."')");
$base -> query('UPDATE `mobs` SET `hp` = `max_hp`, `boss_time_dead` = "'.time().'" WHERE `id` = "'.$boss['id'].'" LIMIT 1');
if($u['hp'] <= 0) $hp = $u['max_hp'] / 4;
else $hp = $u['hp'];
$base -> query('UPDATE `users` SET `hp` = "'.$hp.'", `boss_kills` = `boss_kills` + "1" WHERE `id` = "'.$u['id'].'" LIMIT 1');
$win_msg = '<b>Победа!</b> <img src="/images/icons/exp.png" width="16px">'.n_f($boss['exp']).' <img src="/images/icons/silver.png" width="16px">'.n_f($boss['silver']).'
'.$token_plus.'
'.$drop_text.'
'.$quest_boss_kill.'';
$win_msg_small = '<b>Победа!</b> <img src="/images/icons/exp.png" width="16px">'.n_f($boss['exp']).' <img src="/images/icons/silver.png" width="16px">'.n_f($boss['silver']).'';
if(!$uparty){
$_SESSION['message'] = $win_msg;
$base -> query('UPDATE `users` SET `battle` = "no" WHERE `id` = "'.$u['id'].'" LIMIT 1');
$base -> query('DELETE FROM `pvb` WHERE `id` = "'.$battle['id'].'"');
$base -> query('DELETE FROM `pvb_log` WHERE `pvb_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 `pvb` WHERE `party` = "'.$uparty['id'].'"');
$base -> query('DELETE FROM `pvb_log` WHERE `party_id` = "'.$uparty['id'].'"');
}
unset($_SESSION['user_fast_log']);
unset($_SESSION['enemy_fast_log']);
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'] == 0 AND $uparty['third_user'] == 0){
$base -> query('DELETE FROM `pvb` WHERE `party` = "'.$uparty['id'].'"');
$base -> query('DELETE FROM `pvb_log` WHERE `party_id` = "'.$uparty['id'].'"');
}elseif($uparty['second_user'] != 0 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'] != 0 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'] != 0 OR $uparty['third_user'] != 0){
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
}
if(isset($second_user) AND $second_user['hp'] <= 0){
$base -> query('UPDATE `users` SET
`world` = "'.$first_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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
}
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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
}
}elseif($u['hp'] <= 0){
//Поражение
$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 `pvb_log` WHERE `pvb_id` = "'.$battle['id'].'"');
$base -> query('DELETE FROM `pvb` 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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
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']) $boss_defense = $boss['p_def'];
elseif($type_attack == $u['m_att']) $boss_defense = $boss['m_def'];
$boss_def = mt_rand(($boss_defense / 2), $boss_defense);
$damage = $damage - $boss_def;
$damage = round($damage);
if($damage > 0){
if($critical == true) $log_critical = ' Критический урон!';
$base -> query('UPDATE `mobs` SET `hp` = `hp` - "'.$damage.'" WHERE `id` = "'.$boss['id'].'" LIMIT 1');
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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 `pvb` SET `user_time_attack` = "'.time().'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
header('Location: /pvb/');
exit;
}elseif($damage <= 0){
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
exit;
}else{
if($u['mp'] < $skill['mp_need']){
header('Location: /pvb/');
exit;
}else{
$time_skill = (time() - $skill['cool_down_time']);
if($time_skill < $skill['cool_down']){
header('Location: /pvb/');
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;
$critiacal = false;
}
if($skill['type_attack'] == 'p_att') $boss_defense = $boss['p_def'];
elseif($skill['type_attack'] == 'm_att') $boss_defense = $boss['m_def'];
$boss_def = mt_rand(($boss_defense / 2), $boss_defense);
$damage = $damage - $boss_def;
$damage = round($damage);
if($damage > 0){
if($critical == true) $log_critical = ' Критический урон!';
$base -> query('UPDATE `mobs` SET `hp` = `hp` - "'.$damage.'" WHERE `id` = "'.$boss['id'].'" LIMIT 1');
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$u['login'].' использовал '.$skill['name'].', но промахнулся..."');
}
$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: /pvb/');
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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
exit;
}elseif($skill['type'] == 'massive_heal'){
//Массивное лечащее умение
if($uparty){
$t_u_i_b_q = $base -> query('SELECT * FROM `pvb` 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 `pvb` 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 `pvb` 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 `pvb` WHERE `user` = "'.$uparty['third_user'].'"');
$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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$fu_id_battle['id'].'",
`text` = "'.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$su_id_battle['id'].'",
`text` = "'.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$fu_id_battle['id'].'",
`text` = "'.$u['login'].' использовал '.$skill['name'].' и восстановил по '.$skill['how_many'].' здоровья."');
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_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: /pvb/');
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 `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$u['login'].' наложил на себя усиление '.$skill['name'].'."');
//Дар природы
if($buff['ident_id'] == 5){
$how_hp = $buff['endurance'] * 20;
$new_hp = $u['hp'] + $how_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: /pvb/');
exit;
}
}
}
}
}
}
//Атака босса
$attack_count = intval((time() - $battle['boss_time_attack']) / $boss['time_attack']);
$i = 1;
while($i++<=$attack_count){
if(!$uparty) $user_target = $u;
else $user_target = $first_user;
if($boss['p_att'] > $boss['m_att']) $boss_type_attack = $boss['p_att'];
elseif($boss['m_att'] > $boss['p_att']) $boss_type_attack = $boss['m_att'];
$boss_damage = mt_rand(($boss_type_attack - ($boss_type_attack / 4)),$boss_type_attack);
if($boss_type_attack == $boss['p_att']) $user_defense = $user_target['p_def'];
elseif($boss_type_attack == $boss['m_att']) $user_defense = $user_target['m_def'];
$user_def = mt_rand(($user_defense / 2), $user_defense);
if($user_def < 0) $user_def = 0;
$boss_damage = $boss_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 `pvb_log` SET
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$boss['name'].' пытался атаковать, но вы увернулись."');
$_SESSION['enemy_fast_log'] = ''.$boss['name'].' промахнулся...';
}else{
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$boss['name'].' пытался атаковать, но '.$user_target['login'].' увернулся."');
$_SESSION['enemy_fast_log'] = ''.$boss['name'].' промахнулся...';
}
}else{
if($boss_damage > 0){
$base -> query('UPDATE `users` SET `hp` = `hp` - "'.$boss_damage.'" WHERE `id` = "'.$user_target['id'].'" LIMIT 1');
if(!$uparty){
$base -> query('INSERT INTO `pvb_log` SET
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$boss['name'].' нанёс вам '.$boss_damage.' урона."');
}else{
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$boss['name'].' нанёс '.$user_target['login'].' '.$boss_damage.' урона."');
}
$_SESSION['enemy_fast_log'] = ''.$boss['name'].' нанёс <font color="yellow"><b>'.$boss_damage.'</b></font> урона.';
}else{
$base -> query('INSERT INTO `pvb_log` SET
`party_id` = "'.$uparty['id'].'",
`pvb_id` = "'.$battle['id'].'",
`text` = "'.$boss['name'].' промахнулся..."');
$_SESSION['enemy_fast_log'] = ''.$boss['name'].' промахнулся...';
}
}
if($i > $attack_count){
if(!$uparty) $base -> query('UPDATE `pvb` SET `boss_time_attack` = "'.time().'" WHERE `id` = "'.$battle['id'].'" LIMIT 1');
else $base -> query('UPDATE `pvb` SET `boss_time_attack` = "'.time().'" WHERE `party` = "'.$uparty['id'].'"');
header('Location: /pvb/');
exit;
}
}
$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){
$f_u_i_b_q = $base -> query('SELECT * FROM `pvb` WHERE `user` = "'.$uparty['first_user'].'" LIMIT 1');
$f_u_i_b_nr = $f_u_i_b_q -> num_rows;
if($f_u_i_b_nr > 0){
$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>';
}
}
$s_u_i_b_q = $base -> query('SELECT * FROM `pvb` WHERE `user` = "'.$uparty['second_user'].'" LIMIT 1');
$s_u_i_b_nr = $s_u_i_b_q -> num_rows;
if($s_u_i_b_nr > 0){
$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>';
}
}
$t_u_i_b_q = $base -> query('SELECT * FROM `pvb` WHERE `user` = "'.$uparty['third_user'].'" LIMIT 1');
$t_u_i_b_nr = $t_u_i_b_q -> num_rows;
if($t_u_i_b_nr > 0){
$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'].'" LIMIT 1');
$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>';
}
}
$boss_hp_percents = round($boss['hp']/$boss['max_hp']*100,1);
if($boss_hp_percents > 100) $boss_hp_percents = 100;
echo '</center></td><td width="50%" style="position: relative;"><center><small><font style="text-shadow: black 1px 1px 1px; color: #FFFFFF;">'.$boss['name'].'</font></small><br/><a href="/pvb/attack/"><img style="max-height: 122px;" src="/images/mobs/bosses/'.$boss['image'].'"></a></center>
<center><div class="hp" style="width: 75%; background-size: '.$boss_hp_percents.'% 12px; text-shadow: black 0 1px 0; text-align: left;"><font color="#E0E0E0" size="1">HP: '.n_f($boss['hp']).'/'.n_f($boss['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="/pvb/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="/pvb/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" style=""></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="/pvb/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="/pvb/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="/pvb/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="/pvb/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="/pvb/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="/pvb/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 `pvb_log` WHERE `pvb_id` = "'.$battle['id'].'" ORDER BY `id` DESC LIMIT 3');
else $log_q = $base -> query('SELECT * FROM `pvb_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="/pvb/escape/"><img src="/images/icons/agility.png"> Сбежать</a>';
}
include_once ('core/foot.php');
?>