<table width="100%" border=1 cellspacing="0">
    <tr>
    <td width="250" id="pers" valign="top" rowspan="2"></td>
    <td id="fight" align="center" valign="top"></td>
    <td width="250" id="enemy" valign="top" rowspan="2"></td>
    </tr>
    <tr><td id="log" valign="top" style="font-size:12px;"></td></tr>
</table>
<? require (ROOT.'/modules/wears.php'); 
$pers = user(UID);
$pers_wears = new WEARS;
$pers_wears->get_wears($pers["uid"]);

$fight = fetch("SELECT * FROM fights WHERE ID=".$pers["cfight"]);
if ($fight["type"]=='bfight'):
	$enemy = fetch("SELECT * FROM fight_bots WHERE cfight=".$pers["cfight"]);
	$enemy["user"] = $enemy["name"];
elseif ($fight["type"]=='duel'):
	$enemy = fetch("SELECT * FROM users WHERE cfight=".$pers["cfight"]." AND uid<>".$pers["uid"]);
endif;

$fight["log"] = str_replace('@@','@',$fight["log"]);
$log = explode ('@',$fight["log"],6);
$log = $log[0].'@'.$log[1].'@'.$log[2].'@'.$log[3].'@'.$log[4];
while (substr_count($log,'@@')>0):
	$log = str_replace('@@','@',$log);
endwhile;

$state = '';
if ($fight["type"]=='bfight'):
	$enemy = fight_bot($pers["cfight"]);
	$enemy["user"] = $enemy["name"];
	$sh = "['weapon1','','','',''],['weapon2','','','',''],['ring1','','','',''],['ring2','','','',''],['amulet','','','',''],['helmet','','','',''],['body','','','',''],['belt','','','',''],['arms','','','',''],['gloves','','','',''],['foots','','','','']";	
elseif ($fight["type"]=='duel'):
	$enemy = user($pers["active_enemy"]);
	$enemy_wears = new WEARS;
	$enemy_wears->get_wears($enemy["uid"]);
endif;
if ($fight["status"]=='preend'):
	$state = $fight["info"];
elseif ($fight["status"]=='finished'):
	$state = 'finished';
else:
	if ($enemy["active_hit"]=='' && $pers["active_hit"]!=''):
		$state = 'wait';
	endif;
endif;
?>
<script type="text/javascript">
character([<? $pers_wears->wears_character_string() ?>],['<?=$pers["user"]?>',<?=$pers["level"]?>,<?=$pers["is_hp"]?>,<?=$pers["mx_hp"]?>,<?=$pers["is_mp"]?>,<?=$pers["mx_mp"]?>,<?=$pers["is_ep"]?>,<?=$pers["mx_ep"]?>],'pers');
character([<? if (isset($sh)): echo $sh; else: $enemy_wears->wears_character_string(); endif; ?>],['<?=$enemy["user"]?>',<?=$enemy["level"]?>,<?=$enemy["is_hp"]?>,<?=$enemy["mx_hp"]?>,<?=$enemy["is_mp"]?>,<?=$enemy["mx_mp"]?>,100,100],'enemy');
fight_interface('<?=$state?>');
fight_log('<?=$log?>');
vk = '<?=VCODE?>';
</script>