<?php
require_once 'wcore/core.php';
$t = "Сражения";
require_once 'wcore/head.php';
iank();
$id = isset($_GET['id']) && !empty($_GET['id']) ? intval($_GET['id']) : 0;
$boss_att = isset($_GET['attack']) && $id != 0 && _mc('war_boss', "WHERE `id` = '$id'") != 0 ? mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT * FROM `war_boss` WHERE `id` = '$id' LIMIT 1")) : false;
$boss_att != false ? mysqli_query($mysqli,"INSERT INTO `war_battle` (`user_id`, `boss_id`, `user_hp`, `boss_hp`) VALUES ('$ank['id']','$boss_att['id']','$ank['param_1']','$boss_att['param_1']')") : false;
_mc('war_battle',"WHERE `user_id` = '$ank['level']'")?go('war_fight.php'):false;

if(isset($_GET['battle'])){
	
}else{
	
	$war_boss = mysqli_query($mysqli,"SELECT * FROM `war_boss` ORDER BY `id` LIMIT 5");
	while($boss = mysqli_fetch_assoc($war_boss)){
		
		echo '<br><div class="block">
		<table>
		<tbody>
		<tr>
		<td valign="middle"><img src="img/war/'. $boss['id'] .'.png"></td>
		<td valign="middle" width="100%">
		<b>'. $boss['name'] .'</b> [Lv. '. $boss['level'] .']<br>
		<img src="img/icons/param_1.png">'. $boss['param_1'] .' - <img src="img/icons/param_2.png">'. $boss['param_2'] .'<br>
		<img src="img/icons/param_3.png">'. $boss['param_3'] .' - <img src="img/icons/param_4.png">'. $boss['param_4'] .'<br>
		'. ($ank['level'] >= $boss['level'] ? '<a href="/?attack'. $boss['id'] .'" style="float: right;">Атаковать</a>' : '<span style="float: right">Нужен '. $boss['level'] .' ур.</span>') .'
		</td>
		</tr>
		</tbody>
		</table>
		</div>';
	}
}

require_once 'wcore/foot.php';
?>